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       version 0.09
10

SYNOPSIS

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

DESCRIPTION

28       This adapter lets you specify callback subroutine to be called by
29       Log::Any's logging methods (like $log->debug(), $log->error(), etc) and
30       detection methods (like $log->is_warning(), $log->is_fatal(), etc.).
31
32       This adapter is used for customized logging, and is mostly a convenient
33       construct to save a few lines of code. You could achieve the same
34       effect by creating a full Log::Any adapter class.
35
36       Your logging callback subroutine will be called with these arguments:
37
38        ($method, $self, $format, @params)
39
40       where $method is the name of method (like "debug") and ($self, $format,
41       @params) are given by Log::Any.
42

SEE ALSO

44       Log::Any
45

HOMEPAGE

47       Please visit the project's homepage at
48       <https://metacpan.org/release/Log-Any-Adapter-Callback>.
49

SOURCE

51       Source repository is at
52       <https://github.com/sharyanto/perl-Log-Any-Adapter-Callback>.
53

BUGS

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

AUTHOR

62       Steven Haryanto <stevenharyanto@gmail.com>
63
65       This software is copyright (c) 2014 by Steven Haryanto.
66
67       This is free software; you can redistribute it and/or modify it under
68       the same terms as the Perl 5 programming language system itself.
69
70
71
72perl v5.28.1                      2014-03-15    Log::Any::Adapter::Callback(3)
Impressum