Loïc TROCHET

NAME

Log::Dispatch::Socket - Subclass of Log::Dispatch::Output that log messages to a socket

VERSION

version 0.130020

SYNOPSIS

    use Log::Dispatch;

    my $log = Log::Dispatch->new(
        outputs => [
            [
                'Socket'
            ,   PeerHost  => 'server.foo.com'
            ,   PeerPort  => 9876
            ,   Proto     => 'tcp'
            ,   min_level => 'info'
            ]
        ]
    );

    $log->info("Sorry for my (poor/beginner's/basic) English.");

DESCRIPTION

This module provides, under the Log::Dispatch::* system, a simple object to write messages to a socket listening on some remote host.

It relies on IO::Socket::INET and offers all parameters this module offers.

If this module cannot contact the server during the initialization phase (while running the constructor new), it will die().

If this module fails to log a message because the socket's send() method fails , it will try to reconnect once. If it succeeds, the message will be sent. If the reconnect fails, this module will die().

METHODS

new

The constructor offers all IO::Socket::INET parameters in addition to the standard parameters documented in Log::Dispatch::Output:

log_message(level => $, message => $)

Sends a message if the level is greater than or equal to the object's minimum level.

DESTROY

We disconnect on destruction if it is necessary.

SEE ALSO

Log::Dispatch

Log::Dispatch::UDP

Log::Log4perl::Appender::Socket

AUTHOR

Loïc TROCHET <losyme@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Loïc TROCHET.

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