Class::Usul::Log - Create methods for each logging level that encode their output
use Moo; use Class::Usul::Log; has '_log' => is => 'ro', isa => LogType, lazy => TRUE, builder => '_build__log', reader => 'log', init_arg => 'log'; sub _build__log { my $self = shift; return Class::Usul::Log->new( builder => $self ); } # Can now call the following $self->log->debug( $text ); $self->log->info( $text ); $self->log->warn( $text ); $self->log->error( $text ); $self->log->fatal( $text );
Creates methods for each logging level that encode their output. The logging levels are defined by the log levels constant
Defines the following attributes
debug
Debug flag defaults to FALSE
encoding
Optional output encoding. If present output to the logfile is encoded
log
Optional log object. Will instantiate an instance of Log::Handler if this is not provided
log_attributes
Attributes used to create the log object
logfile
Path to the logfile
BUILDARGS
Monkey with the constructors signature
BUILD
Creates a set of methods defined by the LOG_LEVELS constant. The method expects $self->log and $self->encoding to be set. It encodes the output string prior calling the log method at the given level
LOG_LEVELS
$self->log
$self->encoding
filehandle
Return the loggers file handle
Returns the hash ref passed to the constructor of the log class. Returns undef to indicate no logging, an instance of Class::Null is used instead
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Larry Wall - For the Perl programming language
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2014 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install Class::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Usul
CPAN shell
perl -MCPAN -e shell install Class::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.