line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::ger::Output::SimpleFile; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2017-07-14'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2505
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
45
|
|
7
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
293
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub get_hooks { |
10
|
4
|
|
|
4
|
0
|
5957
|
my %conf = @_; |
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
|
|
10
|
my $fh; |
13
|
4
|
100
|
|
|
|
21
|
if (defined(my $path = $conf{path})) { |
|
|
100
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
135
|
open $fh, ">>", $path or die "Can't open log file '$path': $!"; |
15
|
|
|
|
|
|
|
} elsif ($fh = $conf{handle}) { |
16
|
|
|
|
|
|
|
} else { |
17
|
1
|
|
|
|
|
12
|
die "Please specify 'path' or 'handle'"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return { |
21
|
|
|
|
|
|
|
create_log_routine => [ |
22
|
|
|
|
|
|
|
__PACKAGE__, 50, |
23
|
|
|
|
|
|
|
sub { |
24
|
9
|
|
|
9
|
|
3210
|
my %args = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $logger = sub { |
27
|
3
|
|
|
|
|
1377
|
print $fh $_[1]; |
28
|
3
|
50
|
|
|
|
18
|
print $fh "\n" unless $_[1] =~ /\R\z/; |
29
|
3
|
|
|
|
|
127
|
$fh->flush; |
30
|
9
|
|
|
|
|
40
|
}; |
31
|
9
|
|
|
|
|
36
|
[$logger]; |
32
|
3
|
|
|
|
|
32
|
}], |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
# ABSTRACT: Send logs to file |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |