Manual Reference Pages - CATALYST::PLUGIN::LOG::HANDLER (3)
Catalyst::Plugin::Log::Handler - Catalyst Plugin for Log::Handler
use Catalyst qw(Log::Handler);
Catalyst configuration (e. g. in YAML format):
To log a message:
$c->log->debug(Greetings from the people of earth);
$c->log->info (This is an info message.);
$c->log->warn (This is the last warning.);
$c->log->error(This is an error message.);
$c->log->fatal(This is a fatal message.);
$c->handler->crit(This is a critical message.);
If your Catalyst project logs many messages, logging via standard error to
Apaches error log is not very clean: The log messages are mixed with other web
applications noise; and especially if you use mod_fastcgi, every line will be
prepended with a long prefix.
An alternative is logging to a file. But then you have to make sure that
multiple processes wont corrupt the log file. The module Log::Handler by
Jonny Schulz does exactly this, because it supports message-wise flocking.
This module is a wrapper for said Log::Handler.
debug, info, warn, error, fatal
These methods map to the Log::Handler methods with the same name, except
for fatal, which maps to emergency, and warn, which maps to warning. This is
because Catalyst and Log::Handler dont use the same names for log
To log a message with a level that is no common Catalyst log level, you can
use the handler method (see SYNOPSIS).
is_debug, is_info, is_warn, is_error, is_fatal
These methods map to the Log::Handler methods is_debug, is_info, is_warning,
is_error, is_emergency, respectively.
Returns the Log::Handler object.
All configuration options are passed verbatim to Log::Handler::new. See
Log::Handler for explanation of the options. I think that the example
configuration at the beginning of this document is very well-suited for a
Catalyst application. (Except for the file name, of course.)
To be consistent with Catalyst::Log, the options minlevel and maxlevel
default to 0 and 7, respectively, i. e. all messages are logged. The other
defaults are not touched.
If you use Catalyst::Plugin::ConfigLoader,
please load this module after Catalyst::Plugin::ConfigLoader.
Christoph Bussenius <pepe(at)cpan.org>
If you use this module, Ill be glad if you drop me a note.
You should mention this modules name (or the short form CPLH) in the subject
of your mails, in order to make sure they wont get lost in all the spam.
Copyright (C) 2007,2010 Christoph Bussenius.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
|perl v5.20.3 ||CATALYST::PLUGIN::LOG::HANDLER (3) ||2016-04-03 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.