App::CELL::Log(3pm)
π¦ NAME π¦
App::CELL::Log β the Logging part of CELL, bestie π literally the vibes-delivery system for your logs.
β¨ SYNOPSIS β¨
okay so here's the whole mood board, copy-paste ready:
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 );
quick translation for the girlies: $log->init is your one-time glow-up, $log->$level is you screaming into the void at whatever level Log::Any allows, and ok / not_ok are the App::CELL exclusives that slap an 'OK: ' or 'NOT_OK: ' prefix on an info-level message. iykyk π
π EXPORTS π
this module is generous, it gives you exactly this:
$logβ the App::CELL::Log singleton π«Ά
π PACKAGE VARIABLES π
the little state goblins living inside the package:
$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. no cap. This "App::CELL::Log" module exists to do four iconic things:
- provide documentation
- store the logging category (
$ident) - store the Log::Any log object
- provide convenience functions for logging
'OK'and'NOT_OK'statuses
that's it, that's the whole job, and it ate. π₯
π METHODS π
debug_mode
if you hand it an argument, it sets the $debug_mode package variable. if you hand it nothing, it just returns whatever the current debug-mode setting is. lowkey the easiest method in the whole file.
examples, bestie:
$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;
ident
sets the $ident package variable and the Log::Any category. two birds, one slay π¦
show_caller
sets the $show_caller package variable.
permitted_levels
gives you access to the @permitted_levels package variable. that's the whole thing, she's simple and she's valid.
init
initializes (or *re*configures) the logger. and here's the tea: even though most people will call this to set "ident", it is not required for logging to work. so if you skip it, logging still happens β you're just doing it unlabeled. See App::CELL::Guide for instructions on how to log with App::CELL.
takes a PARAMHASH as argument. the recognized parameters are:
"ident"β (i.e., category) string, e.g.'FooBar'for the FooBar application, or'CELLtest'if none given"show_caller"β sets the$show_callerpackage variable (see above)"debug_mode"β sets the$debug_modepackage variable (see above)
Always returns 1. periodt. π―
DESTROY
for some reason, Perl 5.012 seems to want a DESTROY method. we don't ask questions, we just provide. π
AUTOLOAD
calls Log::Any methods after some pre-processing. the middle-manager of methods, but make it cute.
status_obj
takes a status object and logs it. done and dusted β¨
and that's the whole page, bestie β you're officially fluent in App::CELL::Log. this little love letter comes to you from perl v5.34.0, dated 2022-07-17, and it's User Contributed Perl Documentation, so go forth and log responsibly. π©· mwah. π
π¦ where this page comes from
- debian bookworm: libapp-cell-perl 0.231-1 Β· BSD-3-Clause
- debian trixie: libapp-cell-perl 0.231-1 Β· BSD-3-Clause
- ubuntu noble: libapp-cell-perl 0.231-1 Β· BSD-3-Clause
- ubuntu resolute: libapp-cell-perl 0.231-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms