Log::Dispatchouli - a simple wrapper around Log::Dispatch
my $logger = Log::Dispatchouli->new(\%arg);
This returns a new SvcLogger, which can then be called like a coderef to log stuff. You know. Stuff. Things, too, we'll log those.
Valid arguments are:
ident - the name of the thing logging (mandatory) to_self - log to the logger object for testing; default: false to_file - log to PROGRAM_NAME.YYYYMMDD in the log path; default: false to_stdout - log to STDOUT; default: false to_stderr - log to STDERR; default: false facility - to which syslog facility to send logs; default: none log_pid - if true, prefix all log entries with the pid; default: true fail_fatal - a boolean; if true, failure to log is fatal; default: true debug - a boolean; if true, log_debug method is not a no-op defaults to the truth of the DISPATCHOULI_DEBUG env var
The log path is either /tmp or the value of the DISPATCHOULI_PATH env var.
If the DISPATCHOULI_NOSYSLOG env var is true, we don't log to syslog.
This returns a new logger that doesn't log. It's useful in testing. If no ident arg is provided, one will be generated.
ident
$logger->log(@messages); $logger->log(\%arg, @messages);
This method uses String::Flogger on the input, then logs the result. Each message is flogged individually, then joined with spaces.
If the first argument is a hashref, it will be used as extra arguments to logging. At present, all entries in the hashref are ignored.
This method can also be called as log_info, to match other popular logging interfaces. If you want to override this method, you must override log and not log_info.
log_info
log
This behaves like the log method, but will throw the logged string as an exception after logging.
This behaves like the log method, but will only log (at the debug level) if the SvcLogger object has its debug property set to true.
This gets or sets the SvcLogger's debug property, which affects the behavior of log_debug.
log_debug
is_debug also exists as a read-only accessor. Much less usefully, is_info and is_fatal exist, both of which always return true.
is_debug
is_info
is_fatal
This returns the underlying Log::Dispatch object. This is not the method you're looking for. Move along.
This method returns the arrayref of events logged to an array in memory (in the logger). If the logger is not logging to_self this raises an exception.
to_self
Log::Dispatch
String::Flogger
Ricardo SIGNES, <rjbs@cpan.org>
<rjbs@cpan.org>
Copyright 2008 Ricardo SIGNES. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Log::Dispatchouli, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Dispatchouli
CPAN shell
perl -MCPAN -e shell install Log::Dispatchouli
For more information on module installation, please visit the detailed CPAN module installation guide.