line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Logger::LogAny; |
2
|
|
|
|
|
|
|
# ABSTRACT: Use Log::Any to control logging from your Dancer app |
3
|
|
|
|
|
|
|
$Dancer::Logger::LogAny::VERSION = '0.003'; |
4
|
3
|
|
|
3
|
|
1986
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
107
|
|
5
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
87
|
|
6
|
3
|
|
|
3
|
|
21
|
use Dancer::Config 'setting'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
160
|
|
7
|
3
|
|
|
3
|
|
13
|
use Log::Any; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
25
|
|
8
|
3
|
|
|
3
|
|
90
|
use parent qw{Dancer::Logger::Abstract}; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
16
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $_logger; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
3
|
|
|
3
|
1
|
114
|
my ($self) = @_; |
15
|
3
|
|
100
|
|
|
14
|
my $settings = setting ('LogAny') || {}; |
16
|
3
|
100
|
|
|
|
38
|
if ($settings->{logger}) { |
17
|
1
|
|
|
|
|
541
|
require Log::Any::Adapter; |
18
|
1
|
|
|
|
|
5827
|
Log::Any::Adapter->set (@{$settings->{logger}}); |
|
1
|
|
|
|
|
8
|
|
19
|
|
|
|
|
|
|
} |
20
|
3
|
100
|
|
|
|
2972
|
my %param = exists $settings->{category} |
21
|
|
|
|
|
|
|
? (category => $settings->{category}) |
22
|
|
|
|
|
|
|
: (); |
23
|
3
|
|
|
|
|
14
|
$_logger = Log::Any->get_logger (%param); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _log { |
27
|
135
|
|
|
135
|
|
52878
|
my ($self, $level, $message) = @_; |
28
|
135
|
100
|
|
|
|
305
|
$level = 'info' if $level eq 'core'; |
29
|
135
|
|
|
|
|
337
|
$_logger->$level ($message); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |