The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Log::Dispatch::Buffer - Base class for collecting logged messages

SYNOPSIS

 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;

VERSION

This documentation describes version 0.02.

DESCRIPTION

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.

ADDITIONAL METHODS

Apart from the methods required by Log::Dispatch::Output, the following additional methods are available for this class and any inherited class:

fetch

 $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.

flush

 $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.

MESSAGE FORMAT

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)..

REQUIRED MODULES

 Log::Dispatch (1.16)

AUTHOR

Elizabeth Mattijsen, <liz@dijkmat.nl>.

Please report bugs to <perlbugs@dijkmat.nl>.

COPYRIGHT

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.