NAME
Logger::Fq - Log asynchronously to an Fq instance.
SYNOPSIS
use Logger::Fq;
Logger::Fq::enable_drain_on_exit(1);
my $logger = Logger::Fq->new({ host => '127.0.0.1', port => 8765,
exchange => 'logging });
$logger->log("protocol.category", "Message");
DESCRIPTION
Logger::Fq
provides an asynchronous method of logging information via Fq. Asynchronous in that the creation of the logging and publishing to it will never block perl (assuming an IP address is used).
Methods
- new($options)
-
Creates a new Logger::Fq object.
{ user => $user, #default 'guest' password => $password, #default 'guest' port => $port, #default 8765 host => $vhost, #default '127.0.0.1' exchange => $exchange, #default 'logging' heartbeat => $hearbeat, #default 1000 (ms) }
- log( $channel, $message )
-
$channel
is the routing key used for the Fq message.$message
is the message payload (binary is allowed).
Static Functions
- Logger::Fq::backlog()
-
Return the number of messages backlogged.
- Logger::Fq::drain($s)
-
Wait up to $us seconds (microsecond resolution) waiting for messages to drain to 0. Returns then number of messages drained. If no messages are backlogged, this method does not wait.
- Logger::Fq::enable_drain_on_exit($s, $verbose)
-
This will cause Logger::Fq to register an END {} function that will wait up to $s seconds (microsecond resolution) to drain backlogged messages. If $verbose is specified, print to STDERR the number of messages drain and the time waited.
- Logger::Fq::debug($flags)
-
Sets the fileno=2 debugging bits for libfq.