1Log::Any::Adapter::CallUbsaecrk(C3o)ntributed Perl DocumLeongt:a:tAinoyn::Adapter::Callback(3)
2
3
4

NAME

6       Log::Any::Adapter::Callback - Send Log::Any logs to a subroutine
7

VERSION

9       This document describes version 0.100 of Log::Any::Adapter::Callback
10       (from Perl distribution Log-Any-Adapter-Callback), released on
11       2020-01-14.
12

SYNOPSIS

14        # say, let's POST each log message to an HTTP API server
15        use LWP::UserAgent;
16        my $ua = LWP::UserAgent->new;
17
18        use Log::Any::Adapter;
19        Log::Any::Adapter->set('Callback',
20            min_level    => 'warn',
21            logging_cb   => sub {
22                my ($method, $self, $format, @params) = @_;
23                $ua->post("https://localdomain/log", level=>$method, Content=>$format);
24                sleep 1; # don't overload the server
25            },
26            detection_cb => sub { ... }, # optional, default is: sub { 1 }
27        );
28

DESCRIPTION

30       DEPRECATION NOTICE: Log::Any distribution since 1.708 comes with
31       Log::Any::Adapter::Capture which does the same thing. I'm deprecating
32       this adapter now.
33
34       This adapter lets you specify callback subroutine to be called by
35       Log::Any's logging methods (like $log->debug(), $log->error(), etc) and
36       detection methods (like $log->is_warning(), $log->is_fatal(), etc.).
37
38       This adapter is used for customized logging, and is mostly a convenient
39       construct to save a few lines of code. You could achieve the same
40       effect by creating a full Log::Any adapter class.
41
42       Your logging callback subroutine will be called with these arguments:
43
44        ($method, $self, $format, @params)
45
46       where $method is the name of method (like "debug") and ($self, $format,
47       @params) are given by Log::Any.
48

HOMEPAGE

50       Please visit the project's homepage at
51       <https://metacpan.org/release/Log-Any-Adapter-Callback>.
52

SOURCE

54       Source repository is at
55       <https://github.com/perlancar/perl-Log-Any-Adapter-Callback>.
56

BUGS

58       Please report any bugs or feature requests on the bugtracker website
59       <https://rt.cpan.org/Public/Dist/Display.html?Name=Log-Any-Adapter-Callback>
60
61       When submitting a bug or request, please include a test-file or a patch
62       to an existing test-file that illustrates the bug or desired feature.
63

SEE ALSO

65       Log::Any::Adapter::Capture
66
67       Log::Any
68

AUTHOR

70       perlancar <perlancar@cpan.org>
71
73       This software is copyright (c) 2020, 2014, 2013, 2012, 2011 by
74       perlancar@cpan.org.
75
76       This is free software; you can redistribute it and/or modify it under
77       the same terms as the Perl 5 programming language system itself.
78
79
80
81perl v5.30.1                      2020-01-30    Log::Any::Adapter::Callback(3)
Impressum