line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Fluent::Logger; |
2
|
3
|
|
|
3
|
|
80158
|
use 5.008001; |
|
3
|
|
|
|
|
8
|
|
3
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
59
|
|
4
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
88
|
|
5
|
3
|
|
|
3
|
|
13
|
no warnings qw/redefine/; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
101
|
|
6
|
3
|
|
|
3
|
|
916
|
use Fluent::Logger; |
|
3
|
|
|
|
|
70755
|
|
|
3
|
|
|
|
|
609
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $original__post = Fluent::Logger->can('_post'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $is_active; |
13
|
|
|
|
|
|
|
my @fluent_logs; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub is_active { |
16
|
4
|
|
|
4
|
0
|
780
|
return $is_active; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
2
|
|
|
2
|
|
17
|
activate(); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
*Fluent::Logger::_post = sub { |
23
|
6
|
100
|
|
6
|
|
4289
|
if ($is_active) { |
24
|
5
|
|
|
|
|
6
|
my ($self, $tag, $msg, $time) = @_; |
25
|
5
|
|
100
|
|
|
78
|
push @fluent_logs, { |
26
|
|
|
|
|
|
|
message => $msg, |
27
|
|
|
|
|
|
|
time => $time, |
28
|
|
|
|
|
|
|
tag_prefix => $self->tag_prefix || "", |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
} else { |
31
|
1
|
|
|
|
|
3
|
$original__post->(@_); |
32
|
|
|
|
|
|
|
} |
33
|
2
|
|
|
|
|
2320
|
}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub unimport { |
37
|
1
|
|
|
1
|
|
7
|
deactivate(); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub activate { |
41
|
3
|
|
|
3
|
1
|
321
|
$is_active = 1; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub deactivate { |
45
|
2
|
|
|
2
|
1
|
1252
|
$is_active = 0; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub clear_fluent_logs { |
49
|
3
|
|
|
3
|
1
|
7336
|
@fluent_logs = (); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub get_fluent_logs { |
53
|
4
|
|
|
4
|
1
|
31
|
return @fluent_logs; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |