NAME
BusyBird::Log - simple logging infrastructure for BusyBird
SYNOPSIS
use BusyBird::Log qw(bblog);
bblog('error', 'Something bad happens');
{
my @logs = ();
## Temporarily change the Logger
local $BusyBird::Log::Logger = sub {
my ($level, $msg) = @_;
push(@logs, [$level, $msg]);
};
bblog('info', 'This goes to @logs array.');
}
DESCRIPTION
BusyBird::Log manages the logger singleton used in BusyBird.
This module is used by some of the BusyBird component modules to log warning/error messages.
EXPORTABLE FUNCTIONS
The following functions are exported only by request.
bblog($level, $msg)
Logs the given message.
$level
is a string of log level such as 'info', 'warn', 'error', 'critical' etc. $msg
is the log message body.
By default, it prints the log to STDERR.
PACKAGE VARIABLES
$BusyBird::Log::Logger = CODEREF($level, $msg)
A subroutine reference that is called when bblog()
is called. The subroutine is supposed to do the logging.
Setting this to undef
disables logging at all.
AUTHOR
Toshio Ito <toshioito [at] cpan.org>