line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::App::FakeApache::Log; |
2
|
|
|
|
|
|
|
$Plack::App::FakeApache::Log::VERSION = '0.08'; # TRIAL |
3
|
1
|
|
|
1
|
|
9
|
use Moo; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
575
|
use Apache2::Const -compile => qw(:log); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use APR::Const; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has logger => ( |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
default => sub { sub { 1 } }, |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub log_error { |
14
|
|
|
|
|
|
|
my ($self, @message) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$self->logger->(@message); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub log_serror { |
20
|
|
|
|
|
|
|
my ($self, $file, $line, $level, $status, @message) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$self->logger->(@message); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub log_rerror { |
26
|
|
|
|
|
|
|
my ($self, $file, $line, $level, $status, @message) = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->logger->(@message); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub log_reason { |
32
|
|
|
|
|
|
|
my ($self, $message, $filename) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$self->logger->($message); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my %loglevel = ( |
38
|
|
|
|
|
|
|
emerg => Apache2::Const::LOG_EMERG, |
39
|
|
|
|
|
|
|
alert => Apache2::Const::LOG_ALERT, |
40
|
|
|
|
|
|
|
crit => Apache2::Const::LOG_CRIT, |
41
|
|
|
|
|
|
|
err => Apache2::Const::LOG_ERR, |
42
|
|
|
|
|
|
|
warn => Apache2::Const::LOG_WARNING, |
43
|
|
|
|
|
|
|
notice => Apache2::Const::LOG_NOTICE, |
44
|
|
|
|
|
|
|
info => Apache2::Const::LOG_INFO, |
45
|
|
|
|
|
|
|
debug => Apache2::Const::LOG_DEBUG, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
for my $level (keys %loglevel) { |
49
|
|
|
|
|
|
|
no strict 'refs'; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
*{$level} = sub { |
52
|
|
|
|
|
|
|
my ($self, @message) = @_; |
53
|
|
|
|
|
|
|
my ($package, $filename, $line) = caller; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$self->log_serror( |
56
|
|
|
|
|
|
|
$filename, $line, $loglevel{$level}, APR::Const::SUCCESS, @message |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub LOG_MARK { |
62
|
|
|
|
|
|
|
my ($package, $filename, $line) = caller; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return ($filename, $line); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
*Apache2::Log::LOG_MARK = \&LOG_MARK; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |