No::Worries::Syslog - syslog handling without worries
use No::Worries::Syslog qw(syslog_open syslog_close syslog_info); # setup/open syslog syslog_open(ident => "progname", facility => "daemon"); # report an informational message syslog_info("foo is %s", $foo); # close syslog syslog_close();
This module eases syslog handling by providing convenient wrappers around standard syslog functions.
The functions provide a thin layer on top of Sys::Syslog to make it easier and safer to use. All the functions die() on error and the strings passed to syslog will always be sanitized.
This module provides the following functions (none of them being exported by default):
open a "connection" to syslog using Sys::Syslog's openlog(); supported options
facility: corresponding to openlog()'s eponymous argument
facility
ident: corresponding to openlog()'s eponymous argument
ident
option: corresponding to openlog()'s eponymous argument
option
close a "connection" to syslog using Sys::Syslog's closelog()
sanitize the given string so that it can safely be given to syslog(): UTF-8 encode wide characters, trim trailing spaces, replace tabs by spaces, URI escape non-printable characters and truncate if too long
report a sanitized debugging message to syslog (with LOG_DEBUG priority and [DEBUG] prefix)
[DEBUG]
idem but with sprintf()-like API
report a sanitized informational message to syslog (with LOG_INFO priority and [INFO] prefix)
[INFO]
report a sanitized warning message to syslog (with LOG_WARNING priority and [WARNING] prefix)
[WARNING]
report a sanitized error message to syslog (with LOG_ERR priority and [ERROR] prefix)
[ERROR]
No::Worries::Log handler to send information to syslog; this is not exported and must be called explicitly
This module uses the following global variables (none of them being exported):
maximum length of a message given to syslog (default: 1000)
true if multi-line messages should be logged as separate syslog messages (default: true)
No::Worries, No::Worries::Die, No::Worries::Log, No::Worries::Warn, Sys::Syslog, URI::Escape.
Lionel Cons http://cern.ch/lionel.cons
Copyright (C) CERN 2012-2019
To install No::Worries, copy and paste the appropriate command in to your terminal.
cpanm
cpanm No::Worries
CPAN shell
perl -MCPAN -e shell install No::Worries
For more information on module installation, please visit the detailed CPAN module installation guide.