From f6d7d176814436aa79d5d8c1230d8f7f9e56f7c2 Mon Sep 17 00:00:00 2001 From: doy Date: Wed, 26 Nov 2008 16:25:14 -0500 Subject: add synopsis and description --- lib/Log/Dispatch/Channels.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/Log/Dispatch/Channels.pm b/lib/Log/Dispatch/Channels.pm index 83a5b68..0f8b208 100644 --- a/lib/Log/Dispatch/Channels.pm +++ b/lib/Log/Dispatch/Channels.pm @@ -8,8 +8,37 @@ use Carp; =head1 SYNOPSIS + use Log::Dispatch::Channels; + + my $logger = Log::Dispatch::Channels->new; + $logger->add_channel('foo'); + my $timestamper = sub { my %p = @_; return time . $p{message}; }; + $logger->add_channel('bar', callbacks => $timestamper); + $logger->add(Log::Dispatch::File->new(channels => 'foo', + name => 'foo', + min_level => 'debug', + filename => 'foo.log')); + $logger->add(Log::Dispatch::Null->new(channels => 'bar', + name => 'bar', + min_level => 'debug')); + $logger->add(Log::Dispatch::File->new(channels => [qw/foo bar/], + name => 'errors', + min_level => 'error', + filename => 'error.log')); + $logger->log(channels => 'foo', level => 'debug', + message => 'For foo'); + $logger->log(channels => 'bar', level => 'error', + message => 'For bar and errors'); + =head1 DESCRIPTION +This module manages a set of Log::Dispatch objects, treating them as separate +message channels to which messages can be logged. These objects can share +Log::Dispatch::Output objects, to allow for logging to multiple places +simultaneously and automatically. + +=cut + =method new =cut -- cgit v1.2.3