1Appender::TestBuffer(3)User Contributed Perl DocumentatioAnppender::TestBuffer(3)
2
3
4
6 Log::Log4perl::Appender::TestBuffer - Appender class for testing
7
9 use Log::Log4perl::Appender::TestBuffer;
10
11 my $appender = Log::Log4perl::Appender::TestBuffer->new(
12 name => 'mybuffer',
13 );
14
15 # Append to the buffer
16 $appender->log(
17 level = > 'alert',
18 message => "I'm searching the city for sci-fi wasabi\n"
19 );
20
21 # Retrieve the result
22 my $result = $appender->buffer();
23
24 # Clear the buffer to the empty string
25 $appender->clear();
26
28 This class is used for internal testing of "Log::Log4perl". It is a
29 "Log::Dispatch"-style appender, which writes to a buffer in memory,
30 from where actual results can be easily retrieved later to compare with
31 expected results.
32
33 Every buffer created is stored in an internal global array, and can
34 later be referenced by name:
35
36 my $app = Log::Log4perl::Appender::TestBuffer->by_name("mybuffer");
37
38 retrieves the appender object of a previously created buffer
39 "mybuffer". To reset this global array and have it forget all of the
40 previously created testbuffer appenders (external references to those
41 appenders nonwithstanding), use
42
43 Log::Log4perl::Appender::TestBuffer->reset();
44
47 Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess
48 <cpan@goess.org>.
49
50 This library is free software; you can redistribute it and/or modify it
51 under the same terms as Perl itself.
52
54 Please contribute patches to the project on Github:
55
56 http://github.com/mschilli/log4perl
57
58 Send bug reports or requests for enhancements to the authors via our
59
60 MAILING LIST (questions, bug reports, suggestions/patches):
61 log4perl-devel@lists.sourceforge.net
62
63 Authors (please contact them via the list above, not directly): Mike
64 Schilli <m@perlmeister.com>, Kevin Goess <cpan@goess.org>
65
66 Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens
67 Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse
68 Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis
69 Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David
70 Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter,
71 Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars
72 Thegler, David Viner, Mac Yang.
73
74
75
76perl v5.28.0 2017-02-21 Appender::TestBuffer(3)