| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Gears::Logger; |
|
2
|
|
|
|
|
|
|
$Gears::Logger::VERSION = '0.101'; |
|
3
|
2
|
|
|
2
|
|
207858
|
use v5.40; |
|
|
2
|
|
|
|
|
8
|
|
|
4
|
2
|
|
|
2
|
|
1099
|
use Mooish::Base -standard; |
|
|
2
|
|
|
|
|
166589
|
|
|
|
2
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
467778
|
use Data::Dumper; |
|
|
2
|
|
|
|
|
22096
|
|
|
|
2
|
|
|
|
|
257
|
|
|
7
|
2
|
|
|
2
|
|
1612
|
use Time::Piece; |
|
|
2
|
|
|
|
|
32081
|
|
|
|
2
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# apache format |
|
10
|
|
|
|
|
|
|
has param 'date_format' => ( |
|
11
|
|
|
|
|
|
|
isa => Str, |
|
12
|
|
|
|
|
|
|
default => '%a %b %d %T %Y' |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# apache-like format |
|
16
|
|
|
|
|
|
|
has param 'log_format' => ( |
|
17
|
|
|
|
|
|
|
isa => Maybe [Str], |
|
18
|
|
|
|
|
|
|
default => '[%s] [%s] %s' |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# implements actual logging of a single message |
|
22
|
|
|
|
|
|
|
# must be reimplemented |
|
23
|
0
|
|
|
|
|
0
|
sub _log_message ($self, $level, $message) |
|
|
0
|
|
|
|
|
0
|
|
|
24
|
0
|
|
|
0
|
|
0
|
{ |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
25
|
0
|
|
|
|
|
0
|
...; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
9
|
sub message ($self, $level, @messages) |
|
|
4
|
|
|
|
|
6
|
|
|
29
|
4
|
|
|
4
|
1
|
263723
|
{ |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
8
|
|
|
30
|
4
|
|
|
|
|
16
|
my $format = $self->log_format; |
|
31
|
4
|
|
|
|
|
6
|
my $date; |
|
32
|
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
15
|
for my $message (@messages) { |
|
34
|
5
|
100
|
|
|
|
35
|
$message = ref $message ? Dumper($message) : $message; |
|
35
|
5
|
|
|
|
|
113
|
chomp $message; |
|
36
|
|
|
|
|
|
|
|
|
37
|
5
|
50
|
|
|
|
14
|
if (defined $format) { |
|
38
|
5
|
|
66
|
|
|
28
|
$date //= localtime->strftime($self->date_format); |
|
39
|
5
|
|
|
|
|
821
|
$message = sprintf $format, $date, uc $level, $message; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
5
|
|
|
|
|
25
|
$self->_log_message($level, $message); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
52
|
return $self; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |