Pootle::Logger
Wrapper for the awesome Log::Log4perl
Synopsis
$ENV{POOTLE_CLIENT_VERBOSITY} = 'DEBUG'; #Set the log verbosity using Log::Log4perl log levels
use Pootle::Logger;
my $l = bless({}, 'Pootle::Logger'); #Lazy load package logger this way to avoid circular dependency issues with logger includes from many packages
sub faraway {
$l->debug("Debugging params: "$l->flatten(@_)) if $l->is_debug();
}
$l->isa('Log::Log4perl') logger. Have fun!
_levelToLog4perlLevelInt
There is a bug in Log4perl, where loading use Log::Log4perl qw(:easy); to namespace in this file causes Deep recursion on subroutine "Log::Log4perl::get_logger" at /usr/share/perl5/Log/Log4perl.pm line 339, <FH> line 92.
Work around by not importing log levels, and manually duplicating them here. see /usr/share/perl5/Log/Log4perl/Level.pm for level integers
flatten
my $string = $logger->flatten(@_);
Given a bunch of $@%, the subroutine flattens those objects to a single human-readable string.
@PARAMS Anything, concatenates parameters to one flat string
@RETURNS String, params flattened