App::CELL::Log - the Logging part of CELL
Version 0.210
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:
$log
$ident
$show_caller
$debug_mode
$log_any_obj
@permitted_levels
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.
App::CELL::Log
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.
ident
Takes PARAMHASH as argument. Recognized parameters:
show_caller
debug_mode
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.
To install App::CELL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::CELL
CPAN shell
perl -MCPAN -e shell install App::CELL
For more information on module installation, please visit the detailed CPAN module installation guide.