NAME
Amphibic::Log - Because logging should be fun
VERSION
version 0.02
SYNOPSIS
# In webapp.pl
my $logger = Amphibic::Log->new (name => "webapp");
$logger->info ("Authentication failure");
# In a shell far, far away
$ export LOG_TRACE=1
$ perl webapp.pl
DESCRIPTION
Logging should be a simple thing that everyone do. Yet, few modules if any actually do logging. And many that actually do logging has invented their own logging scheme. The problem isn't dependencies on other modules, but the fact that most logging modules get some fundamental assumptions about where they will be used wrong. This is my attempt at making logging easy and not something to be avoided, even when faced with real world situations like time constraints and lack of planning.
LOG LEVELS
This module is hardcoded with six fairly standard logging levels, namely "fatal", "error", "warn", "info", "debug", and "trace". This module behaves so that enabling a given level in the list above also enables every level before it. Ie, if you enable "trace", you also enable every single other level.
DESTINATIONS
At the moment, only logging to STDERR is supported. Yes, this is going to change, I just want to focus on getting other things right first before adding support for more destinations.
ENABLING LOGGING
To enable logging of all messages:
export LOG_TRACE=1
Or if you are not using bash, use the equivalent command for setting an environment variable in your shell. To enable a given level, set the environment variable LOG_<level> to a true value.
ATTRIBUTES
name
Identify the component name the log messages are coming from. This should be a simple identifier; If the logging entity was DBIx::Class then the identifier should probably be something like "dbic".
METHODS
is_<level>
# $log->is_debug;
Returns a true value if the current logging level is at least at this level. The purpose of these methods is usually so the programmer can avoid running things like expensive debugging routines if it isn't necessary.
<level>
# $log->debug ($message);
Sends $message to the underlying transports.
SEE ALSO
BUGS
Most software has bugs. This module probably isn't an exception. If you find a bug please either email me, or add the bug to cpan-RT.
AUTHOR
Anders Nor Berle <berle@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Anders Nor Berle.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.