line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Middleware::ConsoleLogger; |
2
|
3
|
|
|
3
|
|
34254
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
151
|
|
3
|
3
|
|
|
3
|
|
1196
|
use parent qw(Plack::Middleware); |
|
3
|
|
|
|
|
480
|
|
|
3
|
|
|
|
|
20
|
|
4
|
3
|
|
|
3
|
|
23531
|
use Plack::Util::Accessor qw(group); |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
24
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
206
|
use 5.008001; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
170
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
4550
|
use JavaScript::Value::Escape; |
|
3
|
|
|
|
|
2367
|
|
|
3
|
|
|
|
|
1637
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub call { |
12
|
2
|
|
|
2
|
1
|
67201
|
my($self, $env) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
6
|
my @logs; |
15
|
|
|
|
|
|
|
$env->{'psgix.logger'} = sub { |
16
|
5
|
|
|
5
|
|
242
|
my $args = shift; |
17
|
5
|
|
|
|
|
16
|
push @logs, $args; |
18
|
|
|
|
|
|
|
# TODO cascade? |
19
|
2
|
|
|
|
|
13
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$self->response_cb($self->app->($env), sub { |
22
|
2
|
|
|
2
|
|
72
|
my $res = shift; |
23
|
|
|
|
|
|
|
|
24
|
2
|
50
|
|
|
|
15
|
if (Plack::Util::header_get($res->[1], 'Content-Type') =~ /html/) { |
25
|
|
|
|
|
|
|
return sub { |
26
|
4
|
|
|
|
|
77
|
my $chunk = shift; |
27
|
4
|
100
|
|
|
|
14
|
return unless defined $chunk; |
28
|
2
|
|
|
|
|
17
|
$chunk =~ s! |