1Easy(3)               User Contributed Perl Documentation              Easy(3)
2
3
4

NAME

6       MooseX::Log::Log4perl::Easy - A Logging Role with easy interface for
7       Moose based on MooseX::Log::Log4perl
8

VERSION

10       This document describes MooseX::Log::Log4perl::Easy version 0.31
11

SYNOPSIS

13        package MyApp;
14        use Moose;
15        use Log::Log4perl qw(:easy);
16
17        with 'MooseX::Log::Log4perl::Easy';
18
19        BEGIN {
20               Log::Log4perl->easy_init();
21        }
22
23        sub foo {
24          my ($self) = @_;
25          $self->log_debug("started bar");            ### logs with default class catergory "MyApp"
26          $self->log_info('bar');                     ### logs an info message
27          $self->log('AlsoPossible')->fatal("croak"); ### log
28        }
29

DESCRIPTION

31       The Easy logging role based on the MooseX::Log::Log4perl logging role
32       for Moose directly adds the logmethods for all available levels to your
33       class instance. Hence it is possible to use
34
35         $self->log_info("blabla");
36
37       without having to access a seperate log attribute as in
38       MooseX::Log::Log4perl;
39
40       In case your app grows and you need more of the super-cow powers of
41       Log4perl or simply don't want the additional methodes to clutter up
42       your class you can simply replace all code "$self->log_LEVEL" with
43       "$self->log->LEVEL".
44
45       You can use the following regex substitution to accomplish that:
46
47         s/log(_(trace|debug|info|warn|error|fatal))/log->$2/g
48

ACCESSORS

50   logger
51       See MooseX::Log::Log4perl
52
53   log
54       See MooseX::Log::Log4perl
55
56   log_fatal ($msg)
57       Logs a fatal message $msg using the logger attribute. Same as calling
58
59         $self->logger->fatal($msg)
60
61   log_error ($msg)
62       Logs an error message using the logger attribute. Same as calling
63
64         $self->logger->error($msg)
65
66   log_warn ($msg)
67       Logs a warn message using the logger attribute. Same as calling
68
69         $self->logger->warn($msg)
70
71   log_info ($msg)
72       Logs an info message using the logger attribute. Same as calling
73
74         $self->logger->info($msg)
75
76   log_debug ($msg)
77       Logs a debug message using the logger attribute. Same as calling
78
79         $self->logger->debug($msg)
80
81   log_trace ($msg)
82       Logs a trace message using the logger attribute. Same as calling
83
84         $self->logger->trace($msg)
85

SEE ALSO

87       MooseX::Log::Log4perl, Log::Log4perl, Moose
88

BUGS AND LIMITATIONS

90       Please report any bugs or feature requests to
91       "bug-moosex-log4perl@rt.cpan.org", or through the web interface at
92       <http://rt.cpan.org>.
93
94       Or come bother us in "#moose" on "irc.perl.org".
95

AUTHOR

97       Roland Lammel "<lammel@cpan.org>"
98
99       Inspired by suggestions by Michael Schilli "<m@perlmeister.com>"
100
101       Contributions from Tim Bunce "<TIMB@cpan.org>"
102
104       Copyright (c) 2008-2009, Roland Lammel "<lammel@cpan.org>",
105       http://www.quikit.at. Some rights reserved.
106
107       This module is free software; you can redistribute it and/or modify it
108       under the same terms as Perl itself. See perlartistic.
109
110
111
112perl v5.12.0                      2009-05-17                           Easy(3)
Impressum