WWW::Domain::Registry::Joker::Loggish - a simple logging helper
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...');
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
error() methods so that other classes do not have to worry about implementing them.
WWW::Domain::Registry::Joker::Loggish class provides the following methods:
new ( PARAMS )
Create a new
WWW::Domain::Registry::Joker::Loggishobject with the specified parameters:
A boolean flag for the output of diagnostic messages - should the
debug()method actually display the message passed or simply ignore it.
Log::Dispatchobject to use for the output; if not passed, a new object will be created at first use - see the
logger ( [OBJECT] )
Get or set the
Log::Dispatchobject used for the actual logging.
If no object is specified and no logging object has been set yet, this method will create a
Log::Dispatchobject and a
Log::Dispatch::Screendestination set to output to the standard error stream. If tis does not suit the needs of the application, it should invoke the
logger()method and pass its own
Log::Dispatchhandler. This may also be done at object creation time by passing the
logparameter to the
log ( LEVEL, MESSAGE )
Log the specified message at the specified level.
This method invokes the
logger()method, so that a
Log::Dispatchobject 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 the
debugproperty at object creation time.
error ( MESSAGE )
Log a message with a priority of 'error' using the
Maybe there ought to be a way to toggle the display of diagnostic messages after the object has been created.
WWW::Domain::Registry::Joker::Loggish class was written by Peter Pentchev in 2007.
Peter Pentchev, <firstname.lastname@example.org>
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.