line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Authen::Simple::Log; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
615
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
193
|
|
4
|
6
|
|
|
6
|
|
35
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
164
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
5965
|
use IO::Handle; |
|
6
|
|
|
|
|
55391
|
|
|
6
|
|
|
|
|
2115
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $SINGLETON = bless( {}, __PACKAGE__ ); |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
1
|
47
|
sub new { $SINGLETON } |
11
|
2
|
|
|
2
|
1
|
11
|
sub debug { } |
12
|
2
|
|
|
2
|
1
|
11
|
sub error { shift->_log( 'error', @_ ) } |
13
|
2
|
|
|
2
|
1
|
9
|
sub info { } |
14
|
2
|
100
|
|
2
|
1
|
16
|
sub warn { shift->_log( 'warn', @_ ) if $^W } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _caller { |
17
|
17
|
|
|
17
|
|
27
|
my $self = shift; |
18
|
17
|
|
|
|
|
24
|
my $frame = 0; |
19
|
|
|
|
|
|
|
|
20
|
17
|
|
|
|
|
115
|
$frame++ until ( caller($frame) ne __PACKAGE__ ); |
21
|
|
|
|
|
|
|
|
22
|
17
|
|
|
|
|
110
|
return scalar caller($frame); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _format { |
26
|
17
|
|
|
17
|
|
56
|
my ( $self, $level, @message ) = @_; |
27
|
17
|
|
|
|
|
1208
|
return sprintf( "[%s] [%s] [%s] %s\n", scalar localtime(), $level, $self->_caller, "@message" ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _output { |
31
|
3
|
|
|
3
|
|
5
|
my $self = shift; |
32
|
3
|
|
|
|
|
15
|
STDERR->print(@_); |
33
|
3
|
|
|
|
|
97
|
STDERR->flush; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _log { |
37
|
17
|
|
|
17
|
|
297
|
my $self = shift; |
38
|
17
|
|
|
|
|
75
|
my $message = $self->_format(@_); |
39
|
17
|
|
|
|
|
61
|
$self->_output($message); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |