line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Enbld::Logger; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
2143
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
241
|
|
4
|
6
|
|
|
6
|
|
33
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
169
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
822
|
use autodie; |
|
6
|
|
|
|
|
15201
|
|
|
6
|
|
|
|
|
59
|
|
7
|
6
|
|
|
6
|
|
33380
|
use File::Spec; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
8748
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $LOGFILE; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub logfile { |
12
|
334
|
|
|
334
|
0
|
4198
|
return $LOGFILE; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub rotate { |
16
|
31
|
|
|
31
|
0
|
2367
|
my ( $pkg, $path ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
31
|
|
|
|
|
133
|
_create_logfile( $path ); |
19
|
31
|
|
|
|
|
4913
|
_create_symlink( $path ); |
20
|
|
|
|
|
|
|
|
21
|
31
|
|
|
|
|
5778
|
return $LOGFILE; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub write { |
25
|
212
|
|
|
212
|
0
|
1875
|
my ( $pkg, $msg ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
212
|
|
|
|
|
7406
|
open my $fh, '>>', $LOGFILE; |
28
|
212
|
|
|
|
|
99051
|
print $fh $msg; |
29
|
212
|
|
|
|
|
2035
|
close $fh; |
30
|
|
|
|
|
|
|
|
31
|
212
|
|
|
|
|
25470
|
return $msg; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _create_logfile { |
35
|
31
|
|
|
31
|
|
70
|
my $path = shift; |
36
|
|
|
|
|
|
|
|
37
|
31
|
|
|
|
|
828
|
$LOGFILE = File::Spec->catfile( $path, time . '-' . $$ . '.log' ); |
38
|
31
|
|
|
|
|
226
|
open my $fh, ">", $LOGFILE; |
39
|
31
|
|
|
|
|
15838
|
close $fh; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _create_symlink { |
43
|
31
|
|
|
31
|
|
233
|
my $path = shift; |
44
|
|
|
|
|
|
|
|
45
|
31
|
|
|
|
|
443
|
my $link = File::Spec->catfile( $path, 'latest_build.log' ); |
46
|
31
|
100
|
|
|
|
1032
|
unlink $link if ( -e $link ); |
47
|
31
|
|
|
|
|
628
|
symlink $LOGFILE, $link; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |