Log::Report is a Perl module used to report a problem, pluggable handlers and language support.
INHERITANCE
Log::Report
is a Exporter
SYNOPSIS
# Read section "The Reason for the report" first!!!
# In your main script
use Log::Report 'my-domain';
dispatcher PERL => 'default'
, reasons => 'NOTICE-'; # this disp. is automatically added
dispatcher SYSLOG => 'syslog'
, charset => 'iso-8859-1' # explicit conversions
, locale => 'en_US'; # overrule user's locale
# in all (other) files
use Log::Report 'my-domain';
report ERROR => __x('gettext string', param => $param, ...)
if $condition;
# overrule standard behavior for single message with HASH
use Errno qw/ENOMEM/;
report {to => 'syslog', errno => ENOMEM}
, FAULT => __x"cannot allocate {size} bytes", size => $size;
use Log::Report 'my-domain', syntax => 'SHORT';
error __x('gettext string', param => $param, ...)
if $condition;
# avoid messages without report level
print __"Hello World", "n";
fault __x "cannot allocate {size} bytes", size => $size;
fault "cannot allocate $size bytes"; # no translation
fault __x "cannot allocate $size bytes"; # wrong, not static
print __xn("found one file", "found {_count} files", @files), "n";
try { error }; # catch errors with hidden eval/die
if($@) {...} # $@ isa Log::Report::Dispatcher::Try
use POSIX ':locale_h';
setlocale(LC_ALL, 'nl_NL');
info __"Hello World!"; # in Dutch, if translation table found
my $msg = __x"something", _class => 'local,mine';
if($msg->inClass('local')) ...
Product's homepage
Requirements:
· Perl