line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Logger::Capture::Trap; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:SUKRIA'; |
3
|
|
|
|
|
|
|
$Dancer::Logger::Capture::Trap::VERSION = '1.3520'; |
4
|
|
|
|
|
|
|
# ABSTRACT: a place to store captured Dancer logs |
5
|
86
|
|
|
86
|
|
721
|
use strict; |
|
86
|
|
|
|
|
270
|
|
|
86
|
|
|
|
|
2812
|
|
6
|
86
|
|
|
86
|
|
587
|
use warnings; |
|
86
|
|
|
|
|
276
|
|
|
86
|
|
|
|
|
2442
|
|
7
|
86
|
|
|
86
|
|
526
|
use base 'Dancer::Object'; |
|
86
|
|
|
|
|
316
|
|
|
86
|
|
|
|
|
23829
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->attributes( "_storage" ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
86
|
|
|
86
|
1
|
265
|
my $self = shift; |
14
|
86
|
50
|
|
|
|
344
|
$self->_storage([]) unless $self->_storage; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub store { |
18
|
39
|
|
|
39
|
1
|
94
|
my($self, $level, $message) = @_; |
19
|
|
|
|
|
|
|
|
20
|
39
|
|
|
|
|
64
|
push @{$self->_storage}, { level => $level, message => $message }; |
|
39
|
|
|
|
|
115
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub read { |
26
|
4
|
|
|
4
|
1
|
10
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
14
|
my $logs = $self->_storage; |
29
|
4
|
|
|
|
|
16
|
$self->_storage([]); |
30
|
4
|
|
|
|
|
47
|
return $logs; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |