diff options
author | doy <doy@tozt.net> | 2008-11-26 16:25:14 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-11-26 16:25:14 -0500 |
commit | f6d7d176814436aa79d5d8c1230d8f7f9e56f7c2 (patch) | |
tree | 59153d8dcbdcffb816ebe3689a91da350f6bc87b | |
parent | 3188dd0fedde52bfc4ed22ca3ac96719ebdbb6d2 (diff) | |
download | log-dispatch-channels-f6d7d176814436aa79d5d8c1230d8f7f9e56f7c2.tar.gz log-dispatch-channels-f6d7d176814436aa79d5d8c1230d8f7f9e56f7c2.zip |
add synopsis and description
-rw-r--r-- | lib/Log/Dispatch/Channels.pm | 29 |
1 files changed, 29 insertions, 0 deletions
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 |