Log::Caller
log_debug "scanning new data..."; [debug] scanning new data... at t/00compile.t line 6 log_warn "client %d not found!",$id; [warn] client 123 not found! at t/00compile.t line 8
Take EXPR as a sprintf pattern and evaluate it with LIST if defined, print it to STDERR or the provided filehandle.
use Log::Caller ":all"; use Log::Caller qw[ log_debug log_warn ]; use Log::Caller ":all" => { prefix => ' <prefixin>' }; my $fh; BEGIN { open( $fh, ">", "outs.txt" ) or die "$@ $!" }; use Log::Caller ( "log_debug" => { prefix => 'prefix1>', fh => $fh }, "log_warn" => { prefix => 'prefixDos::' }, );
The following functions are available for export:
log_debug, log_info, log_error, log_warn, log_fatal,
The :all tag is also available for importing all.
There are scores of loggers out there, of varying usefulness, yet I still find myself and others constantly putting warn "blah" everywhere in the code.
Why?
a) because we're lazy, and it's the lowest effort form of logging output for debugging.
b) the call stack is appended nicely
c) because most loggers are full of bloat
I wanted something that would work like warn but be filterable with proper log levels.
Log::Fu - A configurable logger with caller context among other features.
sam@socialflow.com, sponsored by SocialFlow, Inc.
Copyright 2012, Sam Kaufman skaufman@cpan.org
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Log::Caller, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Caller
CPAN shell
perl -MCPAN -e shell install Log::Caller
For more information on module installation, please visit the detailed CPAN module installation guide.