Log::An...Callback(3)
π Log::Any::Adapter::Callback π
okay so bestie, this is the User Contributed Perl Documentation page for Log::Any::Adapter::Callback(3) β the header is giving Log::An...Callback(3) energy. Itβs a logging adapter with a big DEPRECATED stamp, and it sends Log::Any logs straight to a subroutine. Letβs get into it π«Ά
πΈ NAME πΈ
Log::Any::Adapter::Callbackβ (DEPRECATED)(ADOPTME) sendLog::Anylogs to a subroutine π
β¨ VERSION β¨
This document describes version 0.102 of Log::Any::Adapter::Callback (from Perl distribution Log-Any-Adapter-Callback), released on 2023-11-21. π
π¦ SYNOPSIS π¦
okay so imagine youβre like, βsay, letβs POST each log message to an HTTP API serverβ β literally this:
# 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. periodt π
This adapter lets you specify a 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. iykyk β¨
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>. π«Ά
π SEE ALSO π
Log::Any::Adapter::CaptureLog::Any
π AUTHOR π
perlancar <perlancar@cpan.org>
πΈ CONTRIBUTOR πΈ
Steven Haryanto <stevenharyanto@gmail.com>
π CONTRIBUTING π
To contribute, you can send patches by email/via RT, or send pull requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me. π§
π COPYRIGHT AND LICENSE π
- This software is copyright (c)
2023, 2020, 2014, 2013, 2012, 2011byperlancar <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.
π BUGS π
Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Log-Any-Adapter-Callback>.
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. π
β¨ okay thatβs the whole page! The footer says perl v5.42.0, dated 2024-03-08, and itβs the Log::An...Callback(3) manpage. bye bestie π
π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Log-Any-Adapter-Callback 0.102.0-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms