From: Arthur Axel 'fREW' Schmidt Date: Thu, 28 Jul 2011 01:30:55 +0000 (-0500) Subject: Fix regression that caused D* subs to dumper even if the log level was off X-Git-Tag: v0.00305~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0502df63de79b79bd9e5a9351c51be8d86fd4064;p=p5sagit%2FLog-Contextual.git Fix regression that caused D* subs to dumper even if the log level was off --- diff --git a/Changes b/Changes index f32e4b9..84a89f0 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ ChangeLog for Log-Contextual + - Fix regression that caused D* subs to dumper even if the log level was off + 0.00304 2010-07-31 - Add $package_UPTO environment variable for WarnLogger diff --git a/lib/Log/Contextual.pm b/lib/Log/Contextual.pm index 5f9eb14..e855e57 100644 --- a/lib/Log/Contextual.pm +++ b/lib/Log/Contextual.pm @@ -147,14 +147,19 @@ for my $level (@levels) { }; *{"Dlog_$level"} = sub (&@) { - my $code = shift; - local $_ = (@_?Data::Dumper::Concise::Dumper @_:'()'); - return _do_log( $level => _get_logger( caller ), $code, @_ ); + my ($code, @args) = @_; + return _do_log( $level => _get_logger( caller ), sub { + local $_ = (@args?Data::Dumper::Concise::Dumper @args:'()'); + $code->(@_) + }, @args ); }; *{"DlogS_$level"} = sub (&$) { - local $_ = Data::Dumper::Concise::Dumper $_[1]; - _do_logS( $level => _get_logger( caller ), $_[0], $_[1] ) + my ($code, $ref) = @_; + _do_logS( $level => _get_logger( caller ), sub { + local $_ = Data::Dumper::Concise::Dumper $ref; + $code->($ref) + }, $ref ) }; }