No::Wor...::Syslog(3)
π NAME π
No::Worries::Syslog β syslog handling without worries, bestie, like literally zero worries
This is page No::Wor...::Syslog(3) from the User Contributed Perl Documentation, and it's giving "your fave module but make it chill" β¨
πΈ SYNOPSIS πΈ
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();
okay so that's the whole vibe in four lines and honestly? iconic π
π¦ DESCRIPTION π¦
This module eases syslog handling by providing convenient wrappers around standard syslog functions. No cap.
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 β yes, all of them, no silent failures here β and the strings passed to syslog will always be sanitized. So you literally cannot send it something cursed. π§
β¨ FUNCTIONS β¨
This module provides the following functions (none of them being exported by default β you gotta ask for them by name, iykyk):
syslog_open([OPTIONS])β open a "connection" to syslog usingSys::Syslog'sopenlog(). Scare quotes on "connection" because it's not like, a socket you can hold. Supported options are:facilityβ corresponding toopenlog()'s eponymous argumentidentβ corresponding toopenlog()'s eponymous argumentoptionβ corresponding toopenlog()'s eponymous argument
οΌthree options, all named exactly like the openlog() args they map to β the module said "same energy, less stress" π«ΆοΌ
syslog_close()β close a "connection" to syslog usingSys::Syslog'scloselog()syslog_sanitize(STRING)β sanitize the given string so that it can safely be given tosyslog(). The glow-up includes: UTF-8 encode wide characters, trim trailing spaces, replace tabs by spaces, URI escape non-printable characters and truncate if too long. It's giving "spa day for your string" πsyslog_debug(MESSAGE)β report a sanitized debugging message to syslog (withLOG_DEBUGpriority and"[DEBUG]"prefix)syslog_debug(FORMAT, ARGUMENTS...)β idem but withsprintf()-like APIsyslog_info(MESSAGE)β report a sanitized informational message to syslog (withLOG_INFOpriority and"[INFO]"prefix)syslog_info(FORMAT, ARGUMENTS...)β idem but withsprintf()-like APIsyslog_warning(MESSAGE)β report a sanitized warning message to syslog (withLOG_WARNINGpriority and"[WARNING]"prefix)syslog_warning(FORMAT, ARGUMENTS...)β idem but withsprintf()-like APIsyslog_error(MESSAGE)β report a sanitized error message to syslog (withLOG_ERRpriority and"[ERROR]"prefix)syslog_error(FORMAT, ARGUMENTS...)β idem but withsprintf()-like APIlog2syslog(INFO)βNo::Worries::Loghandler to send information to syslog. Heads up bestie: this is not exported and must be called explicitly π
ngl the pattern is so clean: one plain-string version, one sprintf() version, four severity levels, all sanitized. ate and left no crumbs π₯
π GLOBAL VARIABLES π
This module uses the following global variables (none of them being exported β again, you must ask nicely):
$MaximumLengthβ maximum length of a message given to syslog (default:1000)$SplitLinesβ true if multi-line messages should be logged as separate syslog messages (default: true)
π SEE ALSO π
No::Worries, No::Worries::Die, No::Worries::Log, No::Worries::Warn, Sys::Syslog, URI::Escape.
(the whole No::Worries cinematic universe plus the two modules doing the heavy lifting β go read them, fr fr π)
π AUTHOR π
Lionel Cons <http://cern.ch/lionel.cons>
Copyright (C) CERN 2012-2019
π reminder that this is the module's own documented behaviour and nothing more β if the original says it, it's here; if it doesn't, I'm not inventing it. periodt.
perl v5.32.1 πΈ 2021-10-18 π No::Wor...::Syslog(3) β that's the footer, bestie, mwah π
π¦ where this page comes from
- epel 9: perl-No-Worries 1.7-1.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms