From: Arthur Axel 'fREW' Schmidt Date: Thu, 8 Jul 2010 00:48:56 +0000 (-0500) Subject: Use new Log::Log4perl features to clean up caller_depth stuff X-Git-Tag: v0.00302~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b144ba01913732526954180c295cd8865bf84f3f;p=p5sagit%2FLog-Contextual.git Use new Log::Log4perl features to clean up caller_depth stuff --- diff --git a/Changes b/Changes index 0f24843..378da9d 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ ChangeLog for Log-Contextual + - Use Log::Log4perl 1.29 to clean up caller stuff + 0.00300 2010-06-03 - Add -package_logger import option diff --git a/lib/Log/Contextual.pm b/lib/Log/Contextual.pm index fc0c0c1..23770bb 100644 --- a/lib/Log/Contextual.pm +++ b/lib/Log/Contextual.pm @@ -29,6 +29,12 @@ my @log = (qw( log_fatal logS_fatal )); +eval { + require Log::Log4perl; + die if $Log::Log4perl::VERSION < 1.29; + Log::Log4perl->wrapper_register(__PACKAGE__) +}; + our @EXPORT_OK = ( @dlog, @log, qw( set_logger with_logger ) @@ -125,7 +131,6 @@ sub _do_log { my $code = shift; my @values = @_; - local $Log::Log4perl::caller_depth = ($Log::Log4perl::caller_depth || 0 ) + 2; $logger->$level($code->(@_)) if $logger->${\"is_$level"}; @values @@ -137,7 +142,6 @@ sub _do_logS { my $code = shift; my $value = shift; - local $Log::Log4perl::caller_depth = ($Log::Log4perl::caller_depth || 0 ) + 2; $logger->$level($code->($value)) if $logger->${\"is_$level"}; $value