The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::CELL::Log - the Logging part of CELL

VERSION

Version 0.119

SYNOPSIS

    use App::CELL::Log qw( $log );

    # set up logging for application FooBar -- need only be done once
    $log->init( ident => 'FooBar' );  
    
    # log messages at different log levels
    $log->trace    ( "Trace-level message"     );
    $log->debug    ( "Debug-level message"     );
    $log->info     ( "Info-level message"      );
    $log->inform   ( "Info-level message"      );
    $log->ok       ( "Info-level message prefixed with 'OK: '");
    $log->not_ok   ( "Info-level message prefixed with 'NOT_OK: '");
    $log->warning  ( "Warning-level message"   );
    $log->warn     ( "Warning-level message"   );
    $log->error    ( "Error-level message"     );
    $log->critical ( "Critical-level message"  );
    $log->crit     ( "Critical-level message"  );
    $log->fatal    ( "Critical-level message"  );
    $log->alert    ( "Alert-level message"     );
    $log->emergency( "Emergency-level message" );

    # Log a status object (don't do this: it happens automatically when
    # status object is constructed)
    App::CELL::Log::status_obj( $status_obj );

INHERITANCE

This module inherits from Log::Any

EXPORTS

This module provides the following exports:

$log - App::CELL::Log singleton

PACKAGE VARIABLES

$ident - the name of our application
$show_caller - boolean value, determines if caller information is displayed in log messages
$debug_mode - boolean value, determines if we display debug messages
$log - App::CELL::Log singleton object
$log_any_obj - Log::Any singleton object
@permitted_levels - list of permissible log levels

DESCRIPTION

App::CELL's logs using Log::Any. This App::CELL::Log module exists to: (1) provide documentation, (2) store the logging category ($ident), (3) store the Log::Any log object, (4) provide convenience functions for logging 'OK' and 'NOT_OK' statuses.

METHODS

init

Initializes (or reconfigures) the logger. Although in most cases folks will want to call this in order to set ident, it is not required for logging to work. See App::CELL::Guide for instructions on how to log with App::CELL.

Takes PARAMHASH as argument. Recognized parameters:

ident -- (i.e., category) string, e.g. 'FooBar' for the FooBar application, or 'CELLtest' if none given
show_caller -- sets the $show_caller package variable (see above)
debug_mode -- sets the $debug_mode package variable (see above)

Always returns 1.

ident

Accessor method.

AUTOLOAD

Call Log::Any methods after some pre-processing

status_obj

Take a status object and log it.