line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer2::Logger::Multiplex; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
184758
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
82
|
|
4
|
3
|
|
|
3
|
|
86
|
use 5.008_005; |
|
3
|
|
|
|
|
9
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1604
|
use Moo; |
|
3
|
|
|
|
|
27129
|
|
|
3
|
|
|
|
|
15
|
|
8
|
3
|
|
|
3
|
|
4372
|
use Dancer2::Core::Types; |
|
3
|
|
|
|
|
19165
|
|
|
3
|
|
|
|
|
1213
|
|
9
|
|
|
|
|
|
|
with 'Dancer2::Core::Role::Logger'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has loggers => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => ArrayRef, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has logging_engines => ( |
17
|
|
|
|
|
|
|
is => 'lazy', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _build_logging_engines { |
21
|
0
|
|
|
0
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my ($app) = grep { $_->name eq $self->app_name } @{ $Dancer2::runner->apps }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my @logging_engines = map { |
26
|
|
|
|
|
|
|
$app->_factory->create( |
27
|
|
|
|
|
|
|
logger => $_, |
28
|
0
|
|
|
|
|
|
%{ $app->_get_config_for_engine( logger => $_, $app->config ) }, |
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
location => $app->config_location, |
30
|
|
|
|
|
|
|
environment => $app->environment, |
31
|
|
|
|
|
|
|
app_name => $app->name, |
32
|
|
|
|
|
|
|
postponed_hooks => $app->postponed_hooks |
33
|
|
|
|
|
|
|
) |
34
|
0
|
|
|
|
|
|
} @{ $self->loggers }; |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return \@logging_engines; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub log { |
40
|
|
|
|
|
|
|
my ($self, $level, $message) = @_; |
41
|
|
|
|
|
|
|
$_->log($level, $message) for @{ $self->logging_engines }; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
__END__ |