NAME
Log::Handler::Output::Gearman - Send log messages to Gearman workers.
SYNOPSIS
use Log::Handler::Output::Gearman;
my $logger = Log::Handler::Output::Gearman->new(
host => '127.0.0.1',
worker => 'logger',
);
my $message = 'This is a log message';
$logger->log( $message );
DESCRIPTION
This is experimental ( beta ) and should only be used in a test environment. The API may change at any time without prior notification until this message is removed!
METHODS
new
Takes a number of arguments, following are mandatory:
host
host => '127.0.0.1' # hostname / ip-address the B<gearmand> is running on
worker
worker => 'logger' # name of the worker that should process the log messages
Besides it takes also following optional arguments:
port (default: 4730)
port => 4731 # port germand is listening to
method (default: do_background)
method => 'do_high_background'
This can be one of the following Gearman::XS::Client methods:
do
do_high
do_low
do_background
do_high_background
do_low_background
log
Takes two arguments of which the second is optional:
$message
- The log message$options
- Options to override default behaviour per log messageBy default every log message is added to Gearman using
do_background
. This default behaviour can be changed on instantiation by settingmethod =
'...'>. In case you need to send single messages with higher priority you can override this per message:my $message = 'This is a HIGH PRIO log message'; my $options = { method => 'do_high_background' }; $logger->log( $message, $options );
It's also possible to send single messages to other workers:
my $message = 'This is a HIGH PRIO log message'; my $options = { method => 'do_high_background', worker => 'some_other_worker' }; $logger->log( $message, $options );
AUTHOR
Johannes Plunien <plu@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2009 by Johannes Plunien
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.