Skip to content

Instantly share code, notes, and snippets.

@faxm0dem
Created October 1, 2012 14:33
Show Gist options
  • Save faxm0dem/3812144 to your computer and use it in GitHub Desktop.
Save faxm0dem/3812144 to your computer and use it in GitHub Desktop.
log::contextual
# 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);
@faxm0dem
Copy link
Author

faxm0dem commented Oct 1, 2012

I'd like to replace this code with:

use My::Log;
my_log_setup "debug";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment