line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Logger::LogAny; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Dancer::Logger::LogAny::VERSION = '0.002'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Use Log::Any to control logging from your Dancer app |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
2759
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
118
|
|
8
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
104
|
|
9
|
3
|
|
|
3
|
|
29
|
use Dancer::Config 'setting'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
184
|
|
10
|
3
|
|
|
3
|
|
18
|
use Log::Any; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
32
|
|
11
|
3
|
|
|
3
|
|
109
|
use parent qw{Dancer::Logger::Abstract}; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
38
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $_logger; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
3
|
|
|
3
|
1
|
122
|
my ($self) = @_; |
18
|
3
|
|
100
|
|
|
18
|
my $settings = setting ('LogAny') || {}; |
19
|
3
|
100
|
|
|
|
48
|
if ($settings->{logger}) { |
20
|
1
|
|
|
|
|
1047
|
require Log::Any::Adapter; |
21
|
1
|
|
|
|
|
11735
|
Log::Any::Adapter->set (@{$settings->{logger}}); |
|
1
|
|
|
|
|
12
|
|
22
|
|
|
|
|
|
|
} |
23
|
3
|
|
100
|
|
|
4443
|
my $category = $settings->{category} || ''; |
24
|
3
|
|
|
|
|
17
|
$_logger = Log::Any->get_logger (category => $category); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _log { |
28
|
135
|
|
|
135
|
|
73434
|
my ($self, $level, $message) = @_; |
29
|
135
|
100
|
|
|
|
357
|
$level = 'info' if $level eq 'core'; |
30
|
135
|
|
|
|
|
439
|
$_logger->$level ($message); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |