line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer2::Logger::Multiplex; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
162569
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
41
|
|
4
|
2
|
|
|
2
|
|
36
|
use 5.008_005; |
|
2
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
904
|
use Moo; |
|
2
|
|
|
|
|
16342
|
|
|
2
|
|
|
|
|
9
|
|
8
|
2
|
|
|
2
|
|
2847
|
use Dancer2::Core::Types; |
|
2
|
|
|
|
|
12243
|
|
|
2
|
|
|
|
|
833
|
|
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__ |