File Coverage

File:blib/lib/Log/Abstraction/Backend/Fd.pm
Coverage:100.0%

linestmtbrancondsubtimecode
1package Log::Abstraction::Backend::Fd;
2
3# The fd backend: print a formatted line to a file handle
4
37
37
37
109
20
147
use strict;
5
37
37
37
27
19
274
use warnings;
6
7
37
37
37
30
17
40
use parent 'Log::Abstraction::Backend';
8
9our $VERSION = '0.40';
10
11 - 33
=head1 NAME

Log::Abstraction::Backend::Fd - print messages to a file handle

=head1 VERSION

0.40

=head1 DESCRIPTION

Built for a top-level C<fd>, or the C<fd> key of a C<logger> hash.  Each
message is formatted (with the backend's C<format>, or else the logger's)
and printed to the handle.

For use by L<Log::Abstraction> only; see L<Log::Abstraction::Backend>.

=head1 METHODS

=head2 emit

  $backend->emit($logger, $event);

=cut
34
35sub emit {
36
61
40
        my ($self, $logger, $event) = @_;
37
38
61
63
        $event->{'write'}->($self->{'fd'}, $event->{'render'}->($self->{'format'}));
39}
40
41 - 57
=head1 AUTHOR

Nigel Horne C<njh@nigelhorne.com>

=head1 SEE ALSO

L<Log::Abstraction>, L<Log::Abstraction::Backend>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2025-2026 Nigel Horne

Usage is subject to the GPL2 licence terms.
If you use it,
please let me know.

=cut
58
591;