GX::Logger - Default logger component
package MyApp::Logger; use GX::Logger; __PACKAGE__->setup( levels => [ qw( warning error fatal ) ] ); 1;
This module provides the GX::Logger class which extends the GX::Component::Singleton class.
new
Returns the logger component instance.
$logger = $logger_class->new;
$logger ( GX::Logger object )
$logger
GX::Exception
All public methods can be called both as instance and class methods.
debug
Logs the given "debug"-level message(s).
$logger->debug( @messages );
@messages ( strings )
@messages
default_level
Returns the default log level.
$level = $logger->default_level;
$level ( string )
$level
disable
Disables the specified log levels.
$logger->disable( @levels );
@levels ( strings )
@levels
disable_all
Disables all logging.
$logger->disable_all;
enable
Enables the specified log levels.
$logger->enable( @levels );
enable_all
Enables all log levels.
$logger->enable_all;
error
Logs the given "error"-level message(s).
$logger->error( @messages );
fatal
Logs the given "fatal"-level message(s).
$logger->fatal( @messages );
is_enabled
Returns true if the specified log level is active, otherwise false.
$result = logger->is_enabled( $level );
$result ( bool )
$result
levels
Returns / sets the active log levels.
@levels = $logger->levels; @levels = $logger->levels( @levels );
@levels ( strings ) [ optional ]
log
Logs the given message.
$logger->log( $message );
$message ( string )
$message
Alternative syntax:
$logger->log( $level, @messages );
notice
Logs the given "notice"-level message(s).
$logger->notice( @messages );
setup
Sets up the logger.
$class->setup( %options );
default_level ( string )
The default log level. Defaults to "notice".
levels ( ARRAY reference )
ARRAY
The active log levels.
trace
Logs the given "trace"-level message(s).
$logger->trace( @messages );
warning
Logs the given "warning"-level message(s).
$logger->warning( @messages );
By default, all messages are written to STDERR.
STDERR
All log levels, listed in order of increasing importance:
trace debug notice warning error fatal
Jörg A. Uzarek <uzarek@runlevelnull.de>
Copyright (c) 2009-2011 Jörg A. Uzarek.
This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.
To install GX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GX
CPAN shell
perl -MCPAN -e shell install GX
For more information on module installation, please visit the detailed CPAN module installation guide.