NAME

Util::Medley::Logger - Yet another class for logging.

VERSION

version 0.007

SYNOPSIS

 my $log = Util::Medley::Logger->new;
 
 $log->fatal($msg);   
 $log->error($msg);
 $log->warn($msg);
 $log->info($msg);
 $log->verbose(Smsg);
 $log->debug($msg);

 $log->deprecated("old()", "new()");
 

DESCRIPTION

A simple logging class. By default all logs are written to stderr.

ATTRIBUTES

filename (<str>)

If provided, indicates where to write log messages. This will not disable stderr. To do that use disable_stderr().

logDetail (<int>)

Used to indicate how much detail to output with each message. Here is a breakdown:

1 - <msg>
2 - [level] <msg>
3 - [level] [date] <msg>
4 - [level] [date] [pid] <msg>
5 - [level] [date] [pid] [caller($frames)] <msg>

Default: 3

environment vars:

- MEDLEY_LOG_DETAIL=<int>

logFrames (<int>)

Used to indicate how many frames to go back when logDetail invokes the caller() function.

Default: 2

environment vars:

- MEDLEY_LOG_FRAMES=<frames number>

logLevel (<string>)

Indicates what level of log detail you want.

Levels (in order of severity):

- debug
- verbose
- info
- warn
- error
- fatal

Default: info

environment vars:

These are mutually exclusive.

- MEDLEY_LOG_LEVEL=<level string>
- MEDLEY_VERBOSE=<bool>
- MEDLEY_DEBUG=<bool>

disable_stderr (optional)

If provided and true, will disable logging messages to stderr. You should use the 'filename' attribute if you provide true.

METHODS

fatal($msg)

Writes a fatal message to the log and exits with 1.

error($msg)

Writes an error message to the log.

warn($msg)

Writes a warn message to the log.

info($msg)

Writes an info message to the log.

verbose($msg)

Writes a verbose message to the log.

debug($msg)

Writes a debug message to the log.

deprecated($old, $new)

Writes a deprecated message to the log. First arg is the old method/sub. Second arg is the new method/sub.

getLogLevels

Returns an array of all possible levels in severity order.