NAME
WWW::Domain::Registry::Joker::Loggish - a simple logging helper
SYNOPSIS
use WWW::Domain::Registry::Joker::Loggish;
@ISA = qw/WWW::Domain::Registry::Joker::Loggish/;
$self = WWW::Domain::Registry::Joker::Loggish::new($proto,
'debug' => 1);
$self->debug('Diagnostics for the masses');
$self->error('Nobody loves me!');
$self->log('notice', 'Something important is about to happen');
$self->log('debug', 'Nobody ever bothers to read those...');
DESCRIPTION
The WWW::Domain::Registry::Joker::Loggish
class provides a simple logging interface, implemented using the Log::Dispatch
module. It is meant to serve as a parent class providing the log()
, debug()
, and error()
methods so that other classes do not have to worry about implementing them.
METHODS
The WWW::Domain::Registry::Joker::Loggish
class provides the following methods:
new ( PARAMS )
Create a new
WWW::Domain::Registry::Joker::Loggish
object with the specified parameters:debug
A boolean flag for the output of diagnostic messages - should the
debug()
method actually display the message passed or simply ignore it.log
The
Log::Dispatch
object to use for the output; if not passed, a new object will be created at first use - see thelogger()
method below.
logger ( [OBJECT] )
Get or set the
Log::Dispatch
object used for the actual logging.If no object is specified and no logging object has been set yet, this method will create a
Log::Dispatch
object and aLog::Dispatch::Screen
destination set to output to the standard error stream. If tis does not suit the needs of the application, it should invoke thelogger()
method and pass its ownLog::Dispatch
handler. This may also be done at object creation time by passing thelog
parameter to thenew()
method.log ( LEVEL, MESSAGE )
Log the specified message at the specified level.
This method invokes the
logger()
method, so that aLog::Dispatch
object will be created automatically at first use if none has been specified.debug ( MESSAGE )
Log a message with a priority of 'debug' using the
log()
method. Note that whether the message will actually be logged or not will depend on the setting of thedebug
property at object creation time.error ( MESSAGE )
Log a message with a priority of 'error' using the
log()
method.
SEE ALSO
BUGS
Maybe there ought to be a way to toggle the display of diagnostic messages after the object has been created.
HISTORY
The WWW::Domain::Registry::Joker::Loggish
class was written by Peter Pentchev in 2007.
AUTHOR
Peter Pentchev, <roam@ringlet.net>
COPYRIGHT AND LICENSE
Copyright (C) 2007 by Peter Pentchev
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.