line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Prancer::Middleware::Logger; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2851
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
116
|
|
4
|
4
|
|
|
4
|
|
9
|
use warnings FATAL => 'all'; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
97
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
732
|
use Plack::Middleware; |
|
4
|
|
|
|
|
10949
|
|
|
4
|
|
|
|
|
86
|
|
7
|
4
|
|
|
4
|
|
13
|
use parent qw(Plack::Middleware); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
7
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
147
|
use Prancer qw(logger); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
553
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub call { |
12
|
0
|
|
|
0
|
1
|
|
my ($self, $env) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$env->{'psgix.logger'} = sub { |
16
|
0
|
|
|
0
|
|
|
my $args = shift; |
17
|
0
|
|
|
|
|
|
my $level = $args->{'level'}; |
18
|
0
|
|
|
|
|
|
logger->$level($args->{'message'}); |
19
|
0
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { |
23
|
0
|
|
|
0
|
|
|
for (@_) { |
24
|
0
|
|
|
|
|
|
$env->{'psgix.logger'}->({ |
25
|
|
|
|
|
|
|
'level' => 'warn', |
26
|
|
|
|
|
|
|
'message' => $_, |
27
|
|
|
|
|
|
|
}); |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
return $self->app->($env); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Prancer::Middleware::Logger |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DESCRIPTION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This middleware ties C<psgix.logger> to the configured logger in your Prancer |
43
|
|
|
|
|
|
|
application. It also redirects any warnings from your application to the same |
44
|
|
|
|
|
|
|
configured logger. There is no configuration specifically for this middleware. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|