-
-
13 Feb 2021 09:20:43 UTC
- Distribution: Mojo-Log-Syslog
- Module version: 1.03
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository (git clone)
- Issues
- Testers (1 / 0 / 2)
- Kwalitee
Bus factor: 1- % Coverage
- License: artistic_2
- Activity
24 month- Tools
- Download (6.59KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Mojolicious
- Sys::Syslog
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Mojo::Log::Syslog - syslog for Mojo projects
SYNOPSIS
use Mojo::Log::Syslog; $logger = new Mojo::Log::Syslog(facility => 'user', ident => 'myapp', level => 'warn'); app->log($logger);
DESCRIPTION
Syslog-based logger for Mojo applications.
CONSTRUCTOR
The Mojo::Log::Syslog constructor takes the following keyword arguments, all of which are optional:
- facility => FACILITY
-
Sets the syslog facility to use. Valid facility names are:
auth
,authpriv
,cron
,daemon
,ftp
,kern
,local0
throughlocal7
,lpr
,mail
,news
,user
, anduucp
. See also Sys::Syslog(3), section Facilities.The default is
user
. - ident => STRING
-
Syslog message identifier. Defaults to the base name from $0.
- logopt => OPTLIST
-
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
. - level > NAME
-
Sets minimum logging level. See Mojo::Log, for a list of levels.
METHODS
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.EXAMPLE
Using with Mojolicious::Lite
use Mojolicious::Lite; use Mojo::Log::Syslog; my $logger = new Mojo::Log::Syslog(facility => 'local0', level => 'warn'); app->log($logger);
Using with Mojolicious
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); }
SEE ALSO
Mojo::Log(3), Mojolicious(3), Mojolicious::Guides(1), http://mojolicious.org.
Module Install Instructions
To install Mojo::Log::Syslog, copy and paste the appropriate command in to your terminal.
cpanm Mojo::Log::Syslog
perl -MCPAN -e shell install Mojo::Log::Syslog
For more information on module installation, please visit the detailed CPAN module installation guide.