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

NAME

6       MooseX::Log::Log4perl::Easy - A role for easy usage of logging in your
7       Moose based modules based on MooseX::Log::Log4perl
8

SYNOPSIS

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

DESCRIPTION

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

ACCESSORS

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

SEE ALSO

84       MooseX::Log::Log4perl
85

AUTHOR

87       Roland Lammel "<lammel@cpan.org>"
88
90       Copyright (c) 2008-2016, Roland Lammel <lammel@cpan.org>,
91       http://www.quikit.at
92
93       This module is free software; you can redistribute it and/or modify it
94       under the same terms as Perl itself. See perlartistic.
95
96
97
98perl v5.28.0                      2015-12-08                           Easy(3)
Impressum