Bot::Cobalt::Logger - Log handler for Bot::Cobalt
my $logger = Bot::Cobalt::Logger->new( ## Required, one of: debug info warn error level => 'info', ## Optional, passed to Bot::Cobalt::Logger::Output time_format => "%Y/%m/%d %H:%M:%S" log_format => "%time% %pkg% (%level%) %msg%" ); ## Add outputs ## (See Bot::Cobalt::Logger::Output for details) $logger->output->add( 'Output::File' => { file => $path_to_log }, 'Output::Term' => { }, ); ## Log messages $logger->debug("Debugging message", @more_info ); $logger->info("Informative message"); $logger->warn("Warning message"); $logger->error("Error message");
This is the log handler for Bot::Cobalt.
Configured outputs must be added before log messages actually go anywhere (see the "SYNOPSIS"). See Bot::Cobalt::Logger::Output for details.
A level is required at construction-time; messages logged to the specified level or any level below it will be recorded.
For example, a level of 'warn' will discard log messages to 'debug' and 'info' and report only 'warn' and 'error' messages.
Valid levels, from high to low:
debug info warn error
These should be called as methods to log to the appropriate level:
$logger->info("This is some information");
If a list is provided, it will be concatenated with an empty space between items:
$logger->info("Some info", "more info");
Returns the currently tracked log level.
Changes the current log level.
Sets a date/time formatting string to be fed to strftime -- see Bot::Cobalt::Logger::Output
strftime
Sets a formatting template string for log messages -- see Bot::Cobalt::Logger::Output
Returns the Bot::Cobalt::Logger::Output object.
Jon Portnoy <avenj@cobaltirc.org>
To install Bot::Cobalt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Cobalt
CPAN shell
perl -MCPAN -e shell install Bot::Cobalt
For more information on module installation, please visit the detailed CPAN module installation guide.