1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
NAME
Log::Any::Adapter::Callback - (DEPRECATED) Send Log::Any logs to a
subroutine
VERSION
This document describes version 0.101 of Log::Any::Adapter::Callback
(from Perl distribution Log-Any-Adapter-Callback), released on
2020-01-14.
SYNOPSIS
# say, let's POST each log message to an HTTP API server
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
use Log::Any::Adapter;
Log::Any::Adapter->set('Callback',
min_level => 'warn',
logging_cb => sub {
my ($method, $self, $format, @params) = @_;
$ua->post("https://localdomain/log", level=>$method, Content=>$format);
sleep 1; # don't overload the server
},
detection_cb => sub { ... }, # optional, default is: sub { 1 }
);
DESCRIPTION
DEPRECATION NOTICE: Log::Any distribution since 1.708 comes with
Log::Any::Adapter::Capture which does the same thing. I'm deprecating
this adapter now.
This adapter lets you specify callback subroutine to be called by
Log::Any's logging methods (like $log->debug(), $log->error(), etc) and
detection methods (like $log->is_warning(), $log->is_fatal(), etc.).
This adapter is used for customized logging, and is mostly a convenient
construct to save a few lines of code. You could achieve the same effect
by creating a full Log::Any adapter class.
Your logging callback subroutine will be called with these arguments:
($method, $self, $format, @params)
where $method is the name of method (like "debug") and ($self, $format,
@params) are given by Log::Any.
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/Log-Any-Adapter-Callback>.
SOURCE
Source repository is at
<https://github.com/perlancar/perl-Log-Any-Adapter-Callback>.
BUGS
Please report any bugs or feature requests on the bugtracker website
<https://rt.cpan.org/Public/Dist/Display.html?Name=Log-Any-Adapter-Callb
ack>
When submitting a bug or request, please include a test-file or a patch
to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
Log::Any::Adapter::Capture
Log::Any
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020, 2014, 2013, 2012, 2011 by
perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
|