MooseX::Role::Loggable - Extensive, yet simple, logging role using Log::Dispatchouli
version 0.002
package My::Object; use Moose; with 'MooseX::Role::Loggable'; sub do_this { my $self = shift; $self->set_prefix('[do_this] '); $self->log_debug('starting...'); ... $self->log_debug('more stuff'); }
This is a role to provide logging ability to whoever consumes it using Log::Dispatchouli.
Once you consume this role, you have the attributes and methods documented below.
A boolean for whether you're in debugging mode or not.
Default: no.
Read-only.
The facility the logger would use. This is useful for syslog.
Default: local6.
The ident the logger would use. This is useful for syslog.
Default: MooseX::Role::Loggable.
A boolean that determines if the logger would log to a file.
Default location of the file is in /tmp.
A boolean that determines if the logger would log to STDOUT.
A boolean that determines if the logger would log to STDERR.
A Log::Dispatchouli object.
All methods here are imported from Log::Dispatchouli. You can read its documentation to understand them better.
Log a message.
Log a message only if in debug mode.
Log a message and die.
Set a prefix for all next messages.
Sawyer X <xsawyerx@cpan.org>
This software is copyright (c) 2011 by Sawyer X.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install MooseX::Role::Loggable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::Role::Loggable
CPAN shell
perl -MCPAN -e shell install MooseX::Role::Loggable
For more information on module installation, please visit the detailed CPAN module installation guide.