
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 argumentident: corresponding to openlog()'s eponymous argumentoption: corresponding to openlog()'s eponymous argumentclose 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)
idem but with sprintf()-like API
report a sanitized informational message to syslog (with LOG_INFO priority and [INFO] prefix)
idem but with sprintf()-like API
report a sanitized warning message to syslog (with LOG_WARNING priority and [WARNING] prefix)
idem but with sprintf()-like API
report a sanitized error message to syslog (with LOG_ERR priority and [ERROR] prefix)
idem but with sprintf()-like API
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 CERN 2012