projects
/
p5sagit/Log-Contextual.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(parent:
a277756
)
allow set_logger to wrap objects
Arthur Axel 'fREW' Schmidt [Sat, 20 Feb 2010 08:04:40 +0000 (
02:04
-0600)]
lib/Log/Contextual.pm
patch
|
blob
|
blame
|
history
diff --git
a/lib/Log/Contextual.pm
b/lib/Log/Contextual.pm
index
d1da84f
..
4155e6b
100644
(file)
--- a/
lib/Log/Contextual.pm
+++ b/
lib/Log/Contextual.pm
@@
-55,8
+55,11
@@
sub import {
our $Get_Logger;
-sub set_logger (&) {
- $Get_Logger = $_[0];
+sub set_logger {
+ my $logger = $_[0];
+ $logger = do { my $l = $logger; sub { $l } }
+ if ref $logger ne 'CODE';
+ $Get_Logger = $logger;
}
sub with_logger {