actual code (mostly from IRC) and stub test
Arthur Axel 'fREW' Schmidt [Sat, 13 Feb 2010 21:39:13 +0000 (15:39 -0600)]
lib/Log/Contextual.pm
t/log.t

index 982e150..adfca1a 100644 (file)
@@ -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 (file)
--- 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);
+
+