Logger::Syslog(3pm)
π Logger::Syslog β the perl manual page, bestie edition π
okay so this is Logger::Syslog(3pm), and it lives in the User Contributed Perl Documentation corner of your system. pull up a chair π«Ά
β¨ NAME β¨
Logger::Syslog β an intuitive wrapper over Syslog for Perl. it's giving "syslog but make it easy" π
πΈ DESCRIPTION πΈ
so like. you want to deal with syslog, but you do not want to bother with Sys::Syslog. bestie, this module is for you. no cap.
Logger::Syslog takes care of everything regarding the Syslog communication β all you have to do is use the function you need to send a message to syslog. that's it. that's the whole vibe. β¨
and it's so organized too: Logger::Syslog provides one function per Syslog message level β debug, info, warning, error, notice, critic, alert. one function per level, iconic behavior honestly π
π NOTES π
Logger::Syslog is compliant with mod_perl. all you have to do when using it in such an environment is call logger_init() at the beginning of your CGI, and that will garantee that everything will run smoothly. π
lowkey important: if you don't do that, issues with the syslog socket can happen in mod_perl env. so like. call it. please. π
π¦ SYNOPSIS π¦
use Logger::Syslog;
info("Starting at ".localtime());
...
if ($error) {
error("An error occured!");
exit 1;
}
...
notice("There something to notify");
π FUNCTIONS π
π logger_init
call this to explicitly open a Syslog socket. you can optionally specify a Syslog facility. β¨
that function is called when you use the module, if you're not in a mod_perl environment.
examples, bestie:
# open a syslog socket with default facility (user)
logger_init();
# open a syslog socket on the 'local' facility
logger_init('local');
π logger_close
call this to close the Syslog socket. π«Ά
that function is called automatically when the calling program exits. so it's got your back even when you forget. main character energy.
π logger_prefix
that function lets you set a string that will be prefixed to every message sent to syslog. so cute, so useful.
example:
logger_prefix("my program");
info("starting");
...
info("stopping");
π logger_set_default_facility(facility)
you can choose which facility to use, and the default one is "user". use that function if you want to switch smoothly from a facility to another. β¨
heads up: that function will close the existing socket and will open a new one with the appropriate facility. so it's a whole glow-up, not just a lil tweak π
example:
logger_set_default_facility("cron");
β LOGGING β
Logger::Syslog provides one function per Syslog level to let you send messages. want to send a debug message? just use debug(). a warning? use warning(). and so on... iykyk π
all those functions have the same signature: thay take a string as their only argument, which is the message to send to syslog.
examples:
debug("my program starts at ".localtime());
...
warning("some strange stuff occured");
...
error("should not go there !");
...
notice("Here is my notice");
π₯ LICENSE π₯
this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. periodt. π«Ά
π COPYRIGHT π
this program is copyright 2004-2006 Alexis Sukrieh.
π AUTHOR π
Alexis Sukrieh <sukria@sukria.net> β¨
very first versions were made at Cegetel (2004-2005); Thomas Parmelan gave a hand for the mod_perl support. shoutout to the OGs π«‘
okay that's the whole page, we ate and left no crumbs π this was Logger::Syslog(3pm), rendered with perl v5.38.2, dated 2024-03-06 β mwah, love u, go log something responsibly π
β¨
π¦ where this page comes from
- debian trixie: liblogger-syslog-perl 1.1-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblogger-syslog-perl 1.1-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblogger-syslog-perl 1.1-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms