GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  LOG::ANY::ADAPTER::CALLBACK (3)

.ds Aq ’

NAME

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

CONTENTS

VERSION

version 0.09

SYNOPSIS



 # say, lets 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; # dont overload the server
     },
     detection_cb => sub { ... }, # optional, default is: sub { 1 }
 );



DESCRIPTION

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.

SEE ALSO

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/sharyanto/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-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.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 LOG::ANY::ADAPTER::CALLBACK (3) 2014-03-15

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.