Util::Medley::Logger - Yet another class for logging.
version 0.061
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()");
A simple logging class. By default all logs are written to stderr.
If provided and true, will disable logging messages to stderr. You should use the 'filename' attribute if you provide true.
If provided, indicates where to write log messages. This will not disable stderr. To do that use disableStderr().
Note that file locking is used when writing to a file. This allows you to have multiple processes writing to the same log file without stomping on each other.
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>
Get or set the logDetailLevelDebug value. This overrides the logDetailLevel.
Get or set the logDetailLevelVerbose value. This overrides the logDetailLevel.
Get or set the logDetailLevelInfo value. This overrides the logDetailLevel.
Get or set the logDetailLevelWarn value. This overrides the logDetailLevel.
Get or set the logDetailLevelError value. This overrides the logDetailLevel.
Get or set the logDetailLevelFatal value. This overrides the logDetailLevel.
Get or set the logDetailLevelDeprecated value. This overrides the logDetailLevel.
Used to indicate how many frames to go back when logDetailLevel invokes the caller() function. In most cases you shouldn't have to bother with this.
Indicates what level of log detail you want.
Levels (in order of severity):
- debug - verbose - info - warn - error - fatal
Flag to toggle utf8 mode.
Writes a debug message to the log.
$util->debug($msg); $util->debug(msg => $msg);
The message to log.
Writes a deprecated message to the log. First arg is the original method/sub. Second arg is the new method/sub.
$util->deprecated($orig, $new); $util->deprecated(orig => $orig, new => $new);
Name of the deprecated method.
Name of the new method.
Writes an error message to the log.
$util->error($msg); $util->error(msg => $msg);
Writes a fatal message to the log and exits with 1.
$util->fatal($msg); $util->fatal(msg => $msg);
Returns an array of all possible levels in severity order.
@levels = $util->getLogLevels;
Writes an info message to the log.
$util->info($msg); $util->info(msg => $msg);
Writes a verbose message to the log.
$util->verbose($msg); $util->verbose(msg => $msg);
Writes a warn message to the log.
$util->warn($msg); $util->warn(msg => $msg);
To install Util::Medley, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Util::Medley
CPAN shell
perl -MCPAN -e shell install Util::Medley
For more information on module installation, please visit the detailed CPAN module installation guide.