From: Arthur Axel 'fREW' Schmidt Date: Sat, 13 Feb 2010 21:39:13 +0000 (-0600) Subject: actual code (mostly from IRC) and stub test X-Git-Tag: v0.00100~38 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7cec609cfa15bdf1f4cf2132273c55d0e1999f42;p=p5sagit%2FLog-Contextual.git actual code (mostly from IRC) and stub test --- diff --git a/lib/Log/Contextual.pm b/lib/Log/Contextual.pm index 982e150..adfca1a 100644 --- a/lib/Log/Contextual.pm +++ b/lib/Log/Contextual.pm @@ -1,5 +1,22 @@ package Log::Contextual; +our $Get_Logger; + +sub set_logger { + $Get_Logger = $_[0]; +} + +sub log_debug (&) { + my $log = $Get_Logger->(); + $log->debug($_[0]->()) + if $log->is_debug; +} + +sub with_logger { + local $Get_Logger = $_[0]; + $_[1]->() +} + 1; __END__ diff --git a/t/log.t b/t/log.t index e69de29..948f6e1 100644 --- a/t/log.t +++ b/t/log.t @@ -0,0 +1,7 @@ +use strict; +use warnings; + +use Log::Contextual; +use Test::More qw(no_plan); + +