Created
October 1, 2012 14:33
-
-
Save faxm0dem/3812144 to your computer and use it in GitHub Desktop.
log::contextual
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup Logger (source: L<Log::Contextual/LOGGER CODEREF> | |
my @caller_info; | |
my $logref = sub { | |
chomp($_[0]); | |
warn "$_[0] at $caller_info[1] line $caller_info[2].\\n" | |
}; | |
my $var_log = Log::Contextual::SimpleLogger->new({ | |
levels_upto => LEVEL->[$opt->verbose], | |
coderef => $logref, | |
}); | |
my $warn_faker = sub { | |
my ($package, $args) = @_; | |
@caller_info = caller($args->{caller_level}); | |
$var_log | |
}; | |
set_logger ($warn_faker); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd like to replace this code with:
use My::Log;
my_log_setup "debug";