Leyland::Logger - Logging facilities for Leyland application
version 0.001007
# if you're planning on creating a new Leyland logger class, # then do something like this: package Leyland::Logger::SomeLogger; use Moose; use namespace::autoclean; use SomeLogger; has 'obj' => (is => 'ro', isa => 'SomeLogger', writer => '_set_obj'); with 'Leyland::Logger'; sub init { my ($self, $opts) = @_; $self->_set_obj(SomeLogger->new(%$opts)); } sub log { my ($self, $msg) = @_; $self->obj->log(level => $msg->{level}, message => $msg->{message}); } __PACKAGE__->meta->make_immutable;
This Moose role describes how Leyland logger classes, used to log messages generated by the application, are to be built. A logger class will probably use a logger engine, like <Log::Dispatch>, to log messages.
Leyland's default logger class is Leyland::Logger::STDERR, which simply logs messages to the standard error output stream.
A subroutine reference to be automatically called before printing a log message. This subroutine will receive anything in the "args" attribute, plus the message to log. Not used by default.
An array refernce of arguments to pass to the "exec" subroutine.
Consuming classes must implement the following methods:
Receives whatever options where defined for the logger in the application's configuration hash-ref, and initializes a logger object for usage by the logger class. If initialization is not needed, you can define a method that doesn't do anything.
Receives a hash-ref with a level string and a message to log, and prints the message to the log, possibly using the object created by the init() method.
init()
Generates a debug message.
Generates an info message.
Generates a warning message.
Generates an error message.
Receives a reference to a subroutine and possibly a list of arguments, saves the subroutine as the "exec" attribute and the arguments as the "args" attribute.
Returns a true value if the "exec" attribute has a subroutine reference in it.
Removes the current value of the "exec" attribute (if any).
Returns a true value if the "args" attribute has an array-reference in it.
Removes the current value of the "args" attribute (if any).
Ido Perlmuter, <ido at ido50.net>
<ido at ido50.net>
Please report any bugs or feature requests to bug-Leyland at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Leyland. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-Leyland at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Leyland::Logger
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Leyland
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Leyland
CPAN Ratings
http://cpanratings.perl.org/d/Leyland
Search CPAN
http://search.cpan.org/dist/Leyland/
Copyright 2010-2011 Ido Perlmuter.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Leyland, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Leyland
CPAN shell
perl -MCPAN -e shell install Leyland
For more information on module installation, please visit the detailed CPAN module installation guide.