blib/lib/Log/Abstraction/Backend/File.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 18 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Log/Abstraction/Backend/Fd.pm ↑ Summary
1 package Log::Abstraction::Backend::File;
2  
3 # The file backend: append a formatted line to a file
4 42 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 42 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 42 ▶use parent 'Log::Abstraction::Backend';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 42 our $VERSION = '0.40';
10  
11 =head1 NAME
12  
13 Log::Abstraction::Backend::File - append messages to a file
14  
15 =head1 VERSION
16  
17 0.40
18  
19 =head1 DESCRIPTION
20  
21 Built for C<logger =E<gt> $path>, a top-level C<file>, or the C<file> key
22 of a C<logger> hash. Each message is formatted (with the backend's
23 C<format>, or else the logger's) and appended to the file, which is opened
24 for each message. The path is checked, and the file rotated, by
25 Log::Abstraction.
26  
27 For use by L<Log::Abstraction> only; see L<Log::Abstraction::Backend>.
28  
29 =head1 METHODS
30  
31 =head2 emit
32  
33 $backend->emit($logger, $event);
34  
35 =cut
36  
37 168 ▶sub emit {
Subroutine emit: called CC=1 SCAR=0.0
Pod documented
38 168 my ($self, $logger, $event) = @_;
39  
40 168 $event->{'write'}->($self->{'file'}, $event->{'render'}->($self->{'format'}));
41 }
42  
43 =head1 AUTHOR
44  
45 Nigel Horne C<njh@nigelhorne.com>
46  
47 =head1 SEE ALSO
48  
49 L<Log::Abstraction>, L<Log::Abstraction::Backend>
50  
51 =head1 COPYRIGHT AND LICENSE
52  
53 Copyright (C) 2025-2026 Nigel Horne
54  
55 Usage is subject to the GPL2 licence terms.
56 If you use it,
57 please let me know.
58  
59 =cut
60  
61 42 1;
« blib/lib/Log/Abstraction/Backend/Fd.pm ↑ Summary