Koha::Logger
use Koha::Logger; my $logger = Koha::Logger->get; $logger->warn( 'WARNING: Serious error encountered' ); $logger->debug( 'I thought that this code was not used' );
Returns a logger object (based on log4perl). Category and interface hash parameter are optional. Normally, the category should follow the current package and the interface should be set correctly via C4::Context. If the category should not be prefixed if plack, set the param 'prefix' to 0.
my $foo = $logger->put_mdc('foo', $foo );
put_mdc sets global thread specific data that can be access later when generating log lines via the "%X{key}" placeholder in Log::Log4perl::Layout::PatternLayouts.
my $foo = $logger->get_mdc('foo');
Retrieves the stored mdc value from the stored map.
$logger->clear_mdc();
Removes *all* stored key/value pairs from the MDC map.
In order to prevent a crash when log4perl cannot write to Koha logfile, we check first before calling log4perl. If log4perl would add such a check, this would no longer be needed.
Dummy destroy to prevent call to AUTOLOAD
Adds a new appender for the given logger that will log all DEBUG-and-higher messages to stderr. Useful for daemons.
Mojolicous 8.23 added a "context" method, which Mojolicious will die on if it's missing from the logger.
Note: We are just preventing a crash here not returning a new context logger.
Similar to above, Mojolicious has a "history" method and will die on it if it's missing from the logger.
Note: We are just preventing a crash here not returning a new history logger.
Kyle M Hall, <kyle@bywatersolutions.com> Marcel de Rooy, Rijksmuseum