line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#ABSTRACT: Logging role |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HiD::Role::DoesLogging; |
4
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GENEHACK'; |
5
|
|
|
|
|
|
|
$HiD::Role::DoesLogging::VERSION = '1.991'; |
6
|
12
|
|
|
12
|
|
5931
|
use Moose::Role; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
96
|
|
7
|
|
|
|
|
|
|
|
8
|
12
|
|
|
12
|
|
56234
|
use 5.014; # strict, unicode_strings |
|
12
|
|
|
|
|
46
|
|
9
|
|
|
|
|
|
|
|
10
|
12
|
|
|
12
|
|
6740
|
use Log::Log4perl; |
|
12
|
|
|
|
|
396488
|
|
|
12
|
|
|
|
|
58
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
requires 'get_config'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has logger_config => ( |
16
|
|
|
|
|
|
|
is => 'ro' , |
17
|
|
|
|
|
|
|
isa => 'HashRef', |
18
|
|
|
|
|
|
|
lazy => 1 , |
19
|
|
|
|
|
|
|
default => sub { |
20
|
|
|
|
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
my $config = $self->get_config('logger_config'); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return $config |
24
|
|
|
|
|
|
|
if ( $config && %$config ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return { |
27
|
|
|
|
|
|
|
'log4perl.logger' => 'WARN, Screen' , |
28
|
|
|
|
|
|
|
'log4perl.appender.Screen' => 'Log::Log4perl::Appender::Screen', |
29
|
|
|
|
|
|
|
'log4perl.appender.Screen.layout' => 'PatternLayout' , |
30
|
|
|
|
|
|
|
'log4perl.appender.Screen.layout.ConversionPattern' => '[%d] %5p %m%n' , |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has logger => ( |
37
|
|
|
|
|
|
|
is => 'ro' , |
38
|
|
|
|
|
|
|
isa => 'Log::Log4perl::Logger', |
39
|
|
|
|
|
|
|
lazy => 1 , |
40
|
|
|
|
|
|
|
builder => '_build_logger' , |
41
|
|
|
|
|
|
|
handles => { |
42
|
|
|
|
|
|
|
DEBUG => 'debug' , |
43
|
|
|
|
|
|
|
WARN => 'warn' , |
44
|
|
|
|
|
|
|
INFO => 'info' , |
45
|
|
|
|
|
|
|
ERROR => 'error' , |
46
|
|
|
|
|
|
|
FATAL => 'fatal' , |
47
|
|
|
|
|
|
|
LOGWARN => 'logwarn' , |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _build_logger { |
52
|
17
|
|
|
17
|
|
31
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
17
|
|
|
|
|
364
|
Log::Log4perl->init( $self->logger_config ); |
55
|
17
|
|
|
|
|
45335
|
Log::Log4perl->get_logger(); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
12
|
|
|
12
|
|
2041
|
no Moose::Role; |
|
12
|
|
|
|
|
41
|
|
|
12
|
|
|
|
|
198
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding UTF-8 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
HiD::Role::DoesLogging - Logging role |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 logger_config |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Configuration for logging. Defaults to: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
log4perl.logger = DEBUG, Screen |
78
|
|
|
|
|
|
|
log4perl.appender.Screen = Log::Log4perl::Appender::Screen |
79
|
|
|
|
|
|
|
log4perl.appender.Screen.layout = PatternLayout |
80
|
|
|
|
|
|
|
log4perl.appender.Screen.layout.ConversionPattern = [%d] %5p %m%n |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 logger |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Log4perl object for logging. Handles: |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * DEBUG |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * WARN |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * INFO |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * ERROR |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * FATAL |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 VERSION |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
version 1.991 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
John SJ Anderson <genehack@genehack.org> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This software is copyright (c) 2015 by John SJ Anderson. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
113
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |