NetSDS::Logger3pm
Syslog wrapper for applications and classes
Usage
use NetSDS::Logger;my $logger = NetSDS::Logger->new(name => 'NetSDS-SuperDaemon',);$logger->log("info", "Syslog message here");
Overview
This module contains implementation of logging functionality for NetSDS components.
By default, messages are logged with "local0" facility and "pid,ndelay,nowait" options.
NOTE: "NetSDS::Logger" module is for internal use mostly from application frameworks like "NetSDS::App", "NetSDS::App::FCGI", etc.
Class API
new(%parameters)- constructor-
Constructor
new()creates new logger object and opens socket with default NetSDS logging parameters.Arguments allowed (as hash):
name- application name for identificationUse only ASCII characters in "name" to avoid possible errors.Default value is "NetSDS".facility- logging facilityAvailable facility values:* local0..local7* user* daemonIf not set 'local0' is used as default value
- log($level, $message) - write record to log
-
Wrapper to
"syslog()"method of Unix::Syslog module.Level is passed as string and may be one of the following:
alert - LOG_ALERTcrit - LOG_CRITdebug - LOG_DEBUGemerg - LOG_EMERGerror - LOG_ERRinfo - LOG_INFOnotice - LOG_NOTICEwarning - LOG_WARNING
- DESTROY - class destructor
-
Destructor (DESTROY method) calls
"closelog()"function. That's all.
Examples
See NetSDS::App for example.
Todo
1. Implement logging via UDP socket.
Releases
8 releases since Debian 6.0 (Squeeze); the text changed 3 times.