Log::Syslog::Constants - Perl extension containing syslog priority constants as defined in RFC3164.
use Log::Syslog::Constants ':all'; @severities = ( LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG ); @facilities = ( LOG_KERN, LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_SYSLOG, LOG_LPR, LOG_NEWS, LOG_UUCP, LOG_CRON, LOG_AUTHPRIV, LOG_FTP, LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7 ); $info_constant = get_severity('INFO'); $local0_constant = get_facility('local0');
Syslog messages--as standardized in RFC3164--embed a priority number (the PRI part) which is composed of a severity and a facility value. The constants which encode these values are specified in section 4.1.1, and are made available by this module. For instance, the exportable LOG_FTP constant has a value of 11, the value for the FTP facility.
Nothing is exported by default. You may optionally import individual constants and functions or groups of them:
use Log::Syslog::Constants qw(:severities); # LOG_CRIT, LOG_DEBUG, etc use Log::Syslog::Constants qw(:facilities); # LOG_CRON, LOG_LOCAL3, etc use Log::Syslog::Constants qw(:functions); # get_facility, get_severity use Log::Syslog::Constants qw(:all); # all of the above
get_facility($facility_string)
get_severity($severity_string)
These functions look up a constant value by name, e.g. get_severity('info') == LOG_INFO.
get_severity('info') == LOG_INFO
RFC3164
Adam Thomason, <athomason@cpan.org>
Copyright (C) 2010-2011 by Say Media, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install Log::Syslog::Constants, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Syslog::Constants
CPAN shell
perl -MCPAN -e shell install Log::Syslog::Constants
For more information on module installation, please visit the detailed CPAN module installation guide.