App::CELL::Log(3pm) | User Contributed Perl Documentation | App::CELL::Log(3pm) |
App::CELL::Log - the Logging part of CELL
use App::CELL::Log qw( $log ); # set up logging for application FooBar -- need only be done once $log->init( ident => 'FooBar' ); # do not suppess 'trace' and 'debug' messages $log->init( debug_mode => 1 ); # do not append filename and line number of caller $log->init( show_caller => 0 ); # log messages at different log levels my $level = 'warn' # can be any of the levels provided by Log::Any $log->$level ( "Foobar log message" ); # the following App::CELL-specific levels are supported as well $log->ok ( "Info-level message prefixed with 'OK: '"); $log->not_ok ( "Info-level message prefixed with 'NOT_OK: '"); # by default, the caller's filename and line number are appended # to suppress this for an individual log message: $log->debug ( "Debug-level message", suppress_caller => 1 ); # Log a status object (happens automatically when object is # constructed) $log->status_obj( $status_obj ); # Log a message object $log->message_obj( $message_obj );
This module provides the following exports:
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.
If argument provided, set the $debug_mode package variable. If no argument, simply return the current debug-mode setting. Examples:
$log->debug_mode(0); # turn debug mode off $log->debug_mode(1); # turn debug mode on print "Debug mode is on\n" if $log->debug_mode;
Set the $ident package variable and the Log::Any category
Set the $show_caller package variable
Access the @permitted_levels package variable.
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:
Always returns 1.
For some reason, Perl 5.012 seems to want a DESTROY method
Call Log::Any methods after some pre-processing
Take a status object and log it.
2022-07-17 | perl v5.34.0 |