OpenPlugin::Log - Log messages
$OP->log->debug( "The flyswatter is in the corner." ); $OP->log->info( "Successfully read the newspaper." ); $OP->log->warn( "Watch out for that tree!" ); $OP->log->error( "A general exception error has occurred." ); $OP->log->fatal( "Humpty Dumpty had a great fall." );
This logging interface is built on top of Log::Log4perl. It comes with five predefined logging levels, and the ability to dispatch logs to one or more sources.
First, you can configure the logging level in the config file. By default, the logging level is WARN. That means that messages of level WARN, ERROR, and FATAL will be shown. This allows you to control how much logging takes place. Typically, you would just leave the logging level at WARN. But what happens when things aren't working quite right? You can increase the information to be logged by setting the log level to INFO or DEBUG.
WARN
ERROR
FATAL
INFO
DEBUG
What happens when you're working with a large application, and you only wish to debug one portion of your program? This is where Log4perl really starts to shine. Using an OO-like heirarchy, you can set different logging levels for any portion of your application. Additionally, you can alter the destination of the log information based on this same heirarchy.
For an excellent introduction into how you can use this logging facility, please check out Retire your debugger, log smartly with Log::Log4perl!.
debug( $message )
info( $message )
warn( $message )
error( $message )
fatal( $message )
Log $message when at that level or higher. Returns true if a message was logged, false otherwise.
$message
is_debug()
is_info()
is_warn()
is_error()
is_fatal()
Determine's the current log level. Returns true if at that level or higher, false otherwise.
more_logging( $delta )
less_logging( $delta )
inc_level( $delta )
dev_level( $delta )
This allows you to increase or decrease the current level of logging from within your program. $delta must be a positive integer.
$delta
None known.
OpenPlugin, Log::Log4perl
Copyright (c) 2001-2003 Eric Andreychek. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Eric Andreychek <eric@openthought.net>
To install OpenPlugin, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenPlugin
CPAN shell
perl -MCPAN -e shell install OpenPlugin
For more information on module installation, please visit the detailed CPAN module installation guide.