Log::Dispatch::Buffer - Base class for collecting logged messages
use Log::Dispatch::Buffer (); my $channel = Log::Dispatch::Buffer->new( name => 'foo', min_level => 'info', ); my $dispatcher = Log::Dispatch->new $dispatcher->add( $channel ); $dispatcher->warning( "This is a warning" ); my $messages = $channel->fetch; my $messages = $channel->flush; $channel->flush;
This documentation describes version 0.02.
The "Log::Dispatch::Buffer" module is a base class that can als be used by itself. Its only function is to collect messages that are being logged to it until they are obtained for further processing. The reason for its existence, was because the functionality was needed for Log::Dispatch::XML.
Apart from the methods required by Log::Dispatch::Output, the following additional methods are available for this class and any inherited class:
$messages = $channel->fetch;
Obtain an array reference to the messages that have been collected since the output channel was created, or since the last time the "flush" method was called. Does not remove messages from the object.
$messages = $channel->flush; $channel->flush;
Obtain an array reference to the messages that have been collected since the output channel was created, or since the last time the "flush"> method was called. Removes messages from the object. Can also be called in void context to simply remove all messages currently buffered in the output channel.
Each message is represented as a hash reference to the parameters originally passed by Log::Dispatch::Output to the "log_message" method (as described in "CONVENIENCE METHODS" in Log::Dispatch)..
Log::Dispatch (1.16)
Elizabeth Mattijsen, <liz@dijkmat.nl>.
Please report bugs to <perlbugs@dijkmat.nl>.
Copyright (c) 2004, 2007 Elizabeth Mattijsen <liz@dijkmat.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Log::Dispatch::Buffer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Dispatch::Buffer
CPAN shell
perl -MCPAN -e shell install Log::Dispatch::Buffer
For more information on module installation, please visit the detailed CPAN module installation guide.