NAME
Wombat::Logger::LoggerBase - logger base class
SYNOPSIS
package My::Logger;
use base qw(Wombat::Logger::LoggerBase);
DESCRIPTION
Convenience base class for logger implementations. The only method that must be implemented is write()
, plus any accessor methods required for configuration, and start()
and stop()
if resources must be initialized and cleaned up.
CONSTRUCTOR
- new()
-
Construct and return a Wombat::Logger::LoggerBase instance, initializing fields appropriately. If subclasses override the constructor, they must be sure to call
$self->SUPER::new();
ACCESSOR METHODS
- getContainer()
-
Return the Container with which this Logger is associated.
- setContainer($container)
-
Set the Container with which this Logger is associated.
Parameters:
- getLevel()
-
Return the verbosity level of this Logger.
- setLevel($level)
-
Set the verbosity level of this Logger. Messages logged with a higher verbosity than this will be silently ignored.
Allowable values in increasing order are:
The default level is 'ERROR'.
Parameters:
Throws:
PUBLIC METHODS
- log($message, $exception, $level)
-
Send a message and/or an exception to the log destination. If a level is specified, the Logger must be set to a verbosity level greater than or equal to the specified level. If a level is not specified, the message and/or exception will be logged unconditionally.
Parameters:
- write($string)
-
Write the specified string to the log destination. The default implementation does nothing. Subclasses must override this method.
Parameters:
LIFECYCLE METHODS
- start()
-
Prepare for the beginning of active use of this Logger. This method must be called before any of the public methods of the component are utilized. Subclasses should initialize logging resources with this method.
Throws:
- stop()
-
Gracefully terminate the active use of this Logger. This method must be the last called on a given instance of this component. Subclasses should release logging resources with this method.
Throws:
SEE ALSO
Servlet::Util::Exception, Wombat::Exception
AUTHOR
Brian Moseley, bcm@maz.org