On Mon May 14 13:35:10 2012, ETHER wrote:
Show quoted text>
> The wrapper subs for each of the log levels (debug through emergency)
> that dispatch to $self->log() do not bother to rewrite the synonyms to
> their real values (err to error, crit to critical, emerg to emergency,
> warn to warning) - so the underlying Log::Dispatch::Output class gets
> the level unrewritten. This has implications for particular Outputs that
> use these levels for something, for example Log::Dispatch::Perl which
> maps each level to a different implementation coderef.
This patch provides a fix:
---
/home/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Log/Dispatch.pm
2012-05-14 20:37:46.241153266 +0000
+++ /home/ether/patches/Log-Dispatch/lib/Log/Dispatch.pm
2012-05-14 20:39:15.921386694 +0000
@@ -15,12 +15,25 @@
our %LEVELS;
BEGIN {
- foreach my $l (
- qw( debug info notice warn warning err error crit critical
alert emerg emergency )
- ) {
+ my %level_map = (
+ debug => 'debug',
+ info => 'info',
+ notice => 'notice',
+ warn => 'warning',
+ warning => 'warning',
+ err => 'error',
+ error => 'error',
+ crit => 'critical',
+ critical => 'critical',
+ alert => 'alert',
+ emerg => 'emergency',
+ emergency => 'emergency',
+ );
+
+ foreach my $l (keys %level_map) {
my $sub = sub {
my $self = shift;
- $self->log( level => $l, message => "@_" );
+ $self->log( level => $level_map{$l}, message => "@_" );
};
$LEVELS{$l} = 1;