SYNOPSIS

        use NetSDS::Logger;

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

DESCRIPTION

This module contains implementation of logging functionality for NetSDS components.

By default, messages are logged with \*(C`local0\*(C' facility and \*(C`pid,ndelay,nowait\*(C' options.

\s-1NOTE\s0: \*(C`NetSDS::Logger\*(C' module is for internal use mostly from application frameworks like \*(C`NetSDS::App\*(C', \*(C`NetSDS::App::FCGI\*(C', 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 identification Use only ASCII characters in "name" to avoid possible errors. Default value is "NetSDS". facility - logging facility Available facility values:

* local0..local7 * user * daemon

If not set 'local0' is used as default value Wrapper to \*(C`syslog()\*(C' method of Unix::Syslog module. Level is passed as string and 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

\s-1DESTROY\s0 - class destructor

Destructor (\s-1DESTROY\s0 method) calls \*(C`closelog()\*(C' function. That's all.

EXAMPLES

See NetSDS::App for example.

RELATED TO NetSDS::Logger…

Sys::Syslog

TODO

1. Implement logging via \s-1UDP\s0 socket.

AUTHOR

Michael Bochkaryov <[email protected]>

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 \s-1GNU\s0 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 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 General Public License for more details.

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