NAME
Bio::Phylo::Util::Logger - Logging for Bio::Phylo.
SYNOPSIS
use Bio::Phylo::Util::Logger;
# can instantiate as (singleton) object, in this case telling it that only
# messages from Bio::Phylo::Forest with log level >= 3 are displayed...
my $logger->new( -level => 3, -class => 'Bio::Phylo::Forest' );
#...or use static...
Bio::Phylo::Util::Logger->info("Log level too low for this to be printed");
Bio::Phylo::Forest->VERBOSE( -level => 2 );
Bio::Phylo::Util::Logger->info("Not any more, now we're talking");
DESCRIPTION
This class defines a logger, a utility object for logging messages. The other objects in Bio::Phylo use this logger to give detailed feedback about what they are doing at per-class, user-configurable log levels (debug, info, warn, error and fatal). You can tell the logger for each class how verbose to be. The least verbose is level 0, in which case only 'fatal' messages are shown. The most verbose level, 4, shows debugging messages, include from internal methods (i.e. ones that start with underscores, and special 'ALLCAPS' perl methods like DESTROY or TIEARRAY). For example, to monitor what the root class is doing, you would say:
$logger->( -class => 'Bio::Phylo', -level => 4 )
To define global verbosity you can omit the -class argument.
METHODS
CONSTRUCTOR
- new()
-
Constructor for Logger.
Type : Constructor Title : new Usage : my $logger = Bio::Phylo::Util::Logger->new; Function: Instantiates a logger Returns : a Bio::Phylo::Util::Logger object Args : -verbose => verbosity, 0 .. 4 (optional) -package => a package for which to set verbosity (optional)
head2 LOGGING METHODS
- log()
-
Prints argument debugging message, depending on verbosity.
Type : logging method Title : log Usage : $logger->log( "WARN", "warning message" ); Function: prints logging message, depending on verbosity Returns : invocant Args : message log level, logging message
- debug()
-
Prints argument debugging message, depending on verbosity.
Type : logging method Title : debug Usage : $logger->debug( "debugging message" ); Function: prints debugging message, depending on verbosity Returns : invocant Args : logging message
- info()
-
Prints argument informational message, depending on verbosity.
Type : logging method Title : info Usage : $logger->info( "info message" ); Function: prints info message, depending on verbosity Returns : invocant Args : logging message
- warn()
-
Prints argument warning message, depending on verbosity.
Type : logging method Title : warn Usage : $logger->warn( "warning message" ); Function: prints warning message, depending on verbosity Returns : invocant Args : logging message
- error()
-
Prints argument error message, depending on verbosity.
Type : logging method Title : error Usage : $logger->error( "error message" ); Function: prints error message, depending on verbosity Returns : invocant Args : logging message
- fatal()
-
Prints argument fatal message, depending on verbosity.
Type : logging method Title : fatal Usage : $logger->fatal( "fatal message" ); Function: prints fatal message, depending on verbosity Returns : invocant Args : logging message
- PREFIX()
-
Getter and setter of path prefix to strip from source file paths in messages.
Type : Mutator/Accessor Title : PREFIX() Usage : Bio::Phylo::Util::Logger->PREFIX( '/path/to/bio/phylo' ) Function: Sets/gets $PREFIX Returns : Verbose level Args : Optional: a path Comments:
- VERBOSE()
-
Setter for the verbose level. This comes in five levels: 0 = only fatal messages (though, when something fatal happens, you'll most likely get an exception object), 1 = errors (hopefully recoverable), 2 = warnings (recoverable), 3 = info (useful diagnostics), 4 = debug (almost every method call)
Type : Mutator Title : VERBOSE() Usage : Bio::Phylo::Util::Logger->VERBOSE( -level => $level ) Function: Sets/gets verbose level Returns : Verbose level Args : 0 <= $level && $level <= 4 Comments:
SEE ALSO
Also see the manual: Bio::Phylo::Manual.
REVISION
$Id: Phylo.pm 4214 2007-07-15 03:12:14Z rvosa $