-
-
11 Jul 2013 12:40:11 UTC
- Distribution: MooseX-Role-LogHandler
- Module version: 0.008
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (439 / 0 / 0)
- Kwalitee
Bus factor: 0- % Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (9.61KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
NJWalker
- NAME
- SYNOPSIS
- DESCRIPTION
- ACCESSORS
- SEE ALSO
- BUGS AND LIMITATIONS
- AUTHOR
- CONTRIBUTORS
- LICENCE AND COPYRIGHT
NAME
MooseX::Role::LogHandler - A Logging Role for Moose based on Log::Handler
SYNOPSIS
package MyApp; use Moose; # customise log file destination from /tmp/__PACKAGE__.log has logfile => ( isa => 'Str', is => 'ro', default => sub { '/tmp/my.log'} ); # or more full config has logconf => ( isa => 'HashRef', is => 'ro', default => sub {{file => {filename => '/tmp/my.log', maxlevel => 'debug'}}}); with 'MooseX::Role::LogHandler'; sub foo { my ($self) = @_; $self->logger->debug("started bar"); ### logs with default class catergory "MyApp" }
DESCRIPTION
A logging role building a very lightweight wrapper to Log::Handler for use with your Moose classes.
For compatibility the
logger
attribute can be accessed to use a common interface for application logging.ACCESSORS
logger
The
logger
attribute holds the Log::Handler object that implements all logging methods for the defined log levels, such asdebug
orerror
. As this method is defined also in other logging roles/systems like MooseX::Log::LogDispatch this can be thought of as a common logging interface.package MyApp::View::JSON; extends 'MyApp::View'; with 'MooseX::Role::LogHandler'; sub bar { $self->logger->debug("Something could be crappy here"); # logs a debug message $self->logger->debug("Something else could be crappy here"); # logs a debug message }
SEE ALSO
Log::Handler, Moose, MooseX::Log::Log4perl, MooseX::LogDispatch
BUGS AND LIMITATIONS
Please report any bugs or feature requests to
bug-moosex-loghandler@rt.cpan.org
, or through the web interface at http://rt.cpan.org.Or come bother us in
#moose
onirc.perl.org
.AUTHOR
NJ Walker
<njwalker@cpan.org>
All (inc. most documentation) based on the work by Roland Lammel
<lammel@cpan.org>
who was in turn inspired by Chris Prather<perigrin@cpan.org>
and Ash Berlin<ash@cpan.org>
on MooseX::LogDispatchCONTRIBUTORS
LICENCE AND COPYRIGHT
Copyright (c) 2011-2013, NJ Walker
<njwalker@cpan.org>
, Some rights reserved.This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
Module Install Instructions
To install MooseX::Role::LogHandler, copy and paste the appropriate command in to your terminal.
cpanm MooseX::Role::LogHandler
perl -MCPAN -e shell install MooseX::Role::LogHandler
For more information on module installation, please visit the detailed CPAN module installation guide.