<<

NAME

Koha::Logger

SYNOPSIS

    use Koha::Logger;

    my $logger = Koha::Logger->get;
    $logger->warn( 'WARNING: Serious error encountered' );
    $logger->debug( 'I thought that this code was not used' );

FUNCTIONS

get

    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.

put_mdc

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.

get_mdc

my $foo = $logger->get_mdc('foo');

Retrieves the stored mdc value from the stored map.

clear_mdc

$logger->clear_mdc();

Removes *all* stored key/value pairs from the MDC map.

INTERNALS

AUTOLOAD

    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.

DESTROY

    Dummy destroy to prevent call to AUTOLOAD

_init

debug_to_screen

Adds a new appender for the given logger that will log all DEBUG-and-higher messages to stderr. Useful for daemons.

context

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.

history

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.

AUTHOR

Kyle M Hall, <kyle@bywatersolutions.com> Marcel de Rooy, Rijksmuseum

<<