NAME

Log::Stderr - Simple logging to Stderr

SYNOPSIS

To use the logger function and constants (with aliases):

use Log::Stderr qw{:all} ;
$Log::Stderr::DEBUGLEVEL = 2 ;

logger(LOG_INFO,"Starting") ;

To just import the constants (without aliases): use Log::Stderr qw{:constants} ;

To just use the logger function:

use Log::Stderr qw{logger} ;
$Log::Stderr::DEBUGLEVEL = 4 ;

logger(2,"This message will be printed") ;
logger(5,"This one will not") ;

# This is equivalent to set the DEBUGLEVEL to 6
$Log::Stderr::DEBUGLEVEL = LOG_NOTICE ;

Note that nothing will prevent you from importing the aliases only, but that would be a sub-smart idea (probably).

DESCRIPTION

This module provides a convenient way to have a timestamped log output on STDERR. It also defines some mnemonic constants that you may want to use to name the log levels (these were shamelessly stolen from the syslog(3) man page)

This is a tiny module that I find convenient to use to implement logging to STDERR for small-sized scripts. It is mainly a debugging tool. For bigger scripts, or in case you need more elaborated logging (e.g.: to a file, to syslog...), then use another one of the powerful modules in the Log:: hierarchy on CPAN.

LOG_NONE

Don't log at all

LOG_EMERG

system is unusable

LOG_ALERT

action must be taken immediately

LOG_CRIT

critical conditions

LOG_ERR

error conditions

LOG_ERROR

alias of LOG_ERR

LOG_WARNING

warning conditions

LOG_WARN

alias for LOG_WARNING

LOG_NOTICE

normal, but significant, condition

LOG_INFO

informational message

LOG_DEBUG

debug-level message

By default, DEBUGLEVEL is set to LOG_NOTICE. The higher the value, the chattier the program.

SEE ALSO

This module uses Carp.

AUTHOR

Marco Marongiu, <bronto@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010-2015 by Marco Marongiu

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 3 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, see <http://www.gnu.org/licenses/>.