NetSDS::Logger(3pm)

πŸ“¦
version 1.301 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– NetSDS::Logger πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation β€” a whole little syslog wrapper for your apps and your classes, and we're gonna get into it. pull up a chair. 🫢


✨ NAME ✨

NetSDS::Logger β€” a syslog wrapper for applications and classes. it's giving "logging, but make it a whole module." πŸ’…


🌸 SYNOPSIS 🌸

use NetSDS::Logger;

my $logger = NetSDS::Logger->new(
        name => 'NetSDS-SuperDaemon',
);
$logger->log("info", "Syslog message here");

look at her go. she's logging. she's thriving. πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module is literally the whole logging functionality implementation for NetSDS components. that's her job. that's what she does.

by default, messages get logged with the local0 facility and the pid,ndelay,nowait options. no cap, those are the defaults, don't come for me.

NOTE: the NetSDS::Logger module is for internal use, mostly from application frameworks like NetSDS::App, NetSDS::App::FCGI, etc. so like, she's not really out here for the general public β€” she's the backstage queen, not the main stage girlie. πŸ‘‘

πŸ‘‘ CLASS API πŸ‘‘

new(%parameters) β€” the constructor πŸŽ€

new() creates a brand new logger object and opens a socket with the default NetSDS logging parameters. it's giving "hello world, but make it syslog."

the arguments allowed (as a hash, bestie, it's a hash):

  • name β€” the application name, for identification purposes.
use only ASCII characters in name to avoid possible errors. fr fr, keep it ASCII or chaos ensues. 😭

the default value is NetSDS.

  • facility β€” the logging facility.

the available facility values are:

  • local0..local7
  • user
  • daemon

if it's not set, local0 gets used as the default value. iconic default behavior. ⭐

log($level, $message) β€” write a record to the log ✨

this is a wrapper to the syslog() method of the Unix::Syslog module. shoutout Unix::Syslog. 🫢

the level gets passed as a string and it may be one of the following:

  • alert β€” LOG_ALERT
  • crit β€” LOG_CRIT
  • debug β€” LOG_DEBUG
  • emerg β€” LOG_EMERG
  • error β€” LOG_ERR
  • info β€” LOG_INFO
  • notice β€” LOG_NOTICE
  • warning β€” LOG_WARNING

pick your vibe, bestie. one of those. that's the whole menu. πŸ’œ

DESTROY β€” the class destructor πŸ’€

the destructor (the DESTROY method, iykyk) calls the closelog() function.

that's it. that's all she does. no notes. clean exit. slay. πŸ’…


🌈 EXAMPLES 🌈

see NetSDS::App for an example. yes really, that's the whole section. go look. 🧚


🌟 SEE ALSO 🌟

  • Sys::Syslog

πŸ“ TODO πŸ“

  1. implement logging via UDP socket.

(she's not done yet, she's got plans. we love a girl with goals. πŸŽ€)


πŸ’œ AUTHOR πŸ’œ

Michael Bochkaryov <misha@rattler.kiev.ua>


πŸ“œ LICENSE πŸ“œ

Copyright (C) 2008-2009 Net Style Ltd.

this program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

this program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU General Public License for more details.

you should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.


aaaand that's the whole page, bestie!! this one shipped as perl v5.32.1, dated 2021-12-26, under the NetSDS::Logger(3pm) name β€” go log something iconic, mwah πŸ’–βœ¨