| 1 | package Log::Abstraction::Backend::Fd; | ||
| 2 | |||
| 3 | # The fd backend: print a formatted line to a file handle | ||
| 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::Fd - print messages to a file handle | ||
| 14 | |||
| 15 | =head1 VERSION | ||
| 16 | |||
| 17 | 0.40 | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | Built for a top-level C<fd>, or the C<fd> key of a C<logger> hash. Each | ||
| 22 | message is formatted (with the backend's C<format>, or else the logger's) | ||
| 23 | and printed to the handle. | ||
| 24 | |||
| 25 | For use by L<Log::Abstraction> only; see L<Log::Abstraction::Backend>. | ||
| 26 | |||
| 27 | =head1 METHODS | ||
| 28 | |||
| 29 | =head2 emit | ||
| 30 | |||
| 31 | $backend->emit($logger, $event); | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | 63 | ▶ | sub emit { |
|
Subroutine
emit: called CC=1 SCAR=0.0
Pod
documented
| |||
| 36 | 63 | my ($self, $logger, $event) = @_; | |
| 37 | |||
| 38 | 63 | $event->{'write'}->($self->{'fd'}, $event->{'render'}->($self->{'format'})); | |
| 39 | } | ||
| 40 | |||
| 41 | =head1 AUTHOR | ||
| 42 | |||
| 43 | Nigel Horne C<njh@nigelhorne.com> | ||
| 44 | |||
| 45 | =head1 SEE ALSO | ||
| 46 | |||
| 47 | L<Log::Abstraction>, L<Log::Abstraction::Backend> | ||
| 48 | |||
| 49 | =head1 COPYRIGHT AND LICENSE | ||
| 50 | |||
| 51 | Copyright (C) 2025-2026 Nigel Horne | ||
| 52 | |||
| 53 | Usage is subject to the GPL2 licence terms. | ||
| 54 | If you use it, | ||
| 55 | please let me know. | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | 42 | 1; | |