No::Wor...::Syslog(3)

πŸ“¦
version 1.7 Β· 4 versions
, in epel 9

πŸ’– 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 using Sys::Syslog's openlog(). Scare quotes on "connection" because it's not like, a socket you can hold. Supported options are:
    • facility β€” corresponding to openlog()'s eponymous argument
    • ident β€” corresponding to openlog()'s eponymous argument
    • option β€” corresponding to openlog()'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 using Sys::Syslog's closelog()
  • syslog_sanitize(STRING) β€” sanitize the given string so that it can safely be given to syslog(). 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 (with LOG_DEBUG priority and "[DEBUG]" prefix)
  • syslog_debug(FORMAT, ARGUMENTS...) β€” idem but with sprintf()-like API
  • syslog_info(MESSAGE) β€” report a sanitized informational message to syslog (with LOG_INFO priority and "[INFO]" prefix)
  • syslog_info(FORMAT, ARGUMENTS...) β€” idem but with sprintf()-like API
  • syslog_warning(MESSAGE) β€” report a sanitized warning message to syslog (with LOG_WARNING priority and "[WARNING]" prefix)
  • syslog_warning(FORMAT, ARGUMENTS...) β€” idem but with sprintf()-like API
  • syslog_error(MESSAGE) β€” report a sanitized error message to syslog (with LOG_ERR priority and "[ERROR]" prefix)
  • syslog_error(FORMAT, ARGUMENTS...) β€” idem but with sprintf()-like API
  • log2syslog(INFO) β€” No::Worries::Log handler 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