Mojo::Log::Syslog - syslog for Mojo projects
use Mojo::Log::Syslog; $logger = new Mojo::Log::Syslog(facility => 'user', ident => 'myapp', level => 'warn'); app->log($logger);
Syslog-based logger for Mojo applications.
The Mojo::Log::Syslog constructor takes the following keyword arguments, all of which are optional:
Sets the syslog facility to use. Valid facility names are: auth, authpriv, cron, daemon, ftp, kern, local0 through local7, lpr, mail, news, user, and uucp. See also Sys::Syslog(3), section Facilities.
auth
authpriv
cron
daemon
ftp
kern
local0
local7
lpr
mail
news
user
uucp
The default is user.
Syslog message identifier. Defaults to the base name from $0.
Defines the list of options for openlog. OPTLIST is either a string with comma-separated option names or a list reference containing option names. The following two options are equivalent:
logopt => "ndelay,pid,nowait" logopt => [qw(ndeay pid nowait)]
See Sys::Syslog(3) for a list of available option names.
Defaults to ndelay,pid.
ndelay,pid
Sets minimum logging level. See Mojo::Log, for a list of levels.
All methods are inherited from Mojo::Log. The methods debug, warn, info, and error log their messages using the corresponding syslog priorities. The method fatal uses the crit (LOG_CRIT) priority.
crit
use Mojolicious::Lite; use Mojo::Log::Syslog; my $logger = new Mojo::Log::Syslog(facility => 'local0', level => 'warn'); app->log($logger);
package MyApp; use Mojo::Base 'Mojolicious'; sub startup { my $self = shift; my $logger = new Mojo::Log::Syslog(facility => 'local0', level => 'warn'); $self->app->log($logger); }
Mojo::Log(3), Mojolicious(3), Mojolicious::Guides(1), http://mojolicious.org.
To install Mojo::Log::Syslog, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Log::Syslog
CPAN shell
perl -MCPAN -e shell install Mojo::Log::Syslog
For more information on module installation, please visit the detailed CPAN module installation guide.