Hi all,
just added return values to Log4perl's logging methods, please let me know if you like it or want something added/removed/modified:
Return Values
All logging methods return values indicating if
their message actually reached one or more
appenders. If the message has been suppressed
because of level constraints, "undef" is returned.
For example,
my $ret = $logger->info("Message");
will return "undef" if the system debug level for
the current category is not "INFO" or more
permissive. If Log::Log4perl forwarded the message
to one or more appenders, the number of appenders
is returned.
If appenders decide to veto on the message with an
appender threshold, the log method's return value
will have them excluded. This means that if you've
got one appender holding an appender threshold and
you're logging a message which passes the system's
log level hurdle but not the appender threshold, 0
will be returned by the log function.
The bottom line is: Logging functions will return
a *true* value if the message made it through to
one or more appenders and a *false* value if it
didn't. This allows for constructs like
$logger->fatal("@_") or print STDERR "@_\n";
which will ensure that the fatal message isn't
lost if the current level is lower than FATAL or
printed twice if the level is acceptable but an
appender already points to STDERR.
--
-- Mike
############################
# Mike Schilli #
# log...@pe... #
# http://perlmeister.com #
# log4perl.sourceforge.net #
############################
|