line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Any::Adapter::File; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Log::Any::Adapter::File::VERSION = '0.11'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
1072
|
use IO::File; |
|
1
|
|
|
|
|
1068
|
|
|
1
|
|
|
|
|
234
|
|
6
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
8
|
1
|
|
|
1
|
|
11
|
use base qw(Log::Any::Adapter::FileScreenBase); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
762
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
0
|
3
|
my ( $class, $file ) = @_; |
12
|
1
|
|
|
|
|
9
|
return $class->SUPER::new( file => $file ); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub init { |
16
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
17
|
1
|
|
|
|
|
12
|
my $file = $self->{file}; |
18
|
1
|
50
|
|
|
|
143
|
open( $self->{fh}, ">>", $file ) |
19
|
|
|
|
|
|
|
or die "cannot open '$file' for append: $!"; |
20
|
1
|
|
|
|
|
17
|
$self->{fh}->autoflush(1); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__PACKAGE__->make_logging_methods( |
24
|
|
|
|
|
|
|
sub { |
25
|
1
|
|
|
1
|
|
6
|
my ( $self, $text ) = @_; |
26
|
1
|
|
|
|
|
227
|
my $msg = sprintf( "[%s] %s\n", scalar(localtime), $text ); |
27
|
1
|
|
|
|
|
12
|
$self->{fh}->print($msg); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |