The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Log::Dispatch::Socket - Log messages to a socket.

VERSION

Version 0.01

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

log_message

SEE ALSO

Log::Dispatch

Log::Dispatch::UDP

Log::Log4perl::Appender::Socket

TODO

Add some tests for version 0.02

AUTHOR

Loïc TROCHET <losyme@gmail.com>

Repository available at https://github.com/losyme/Log-Dispatch-Socket.

COPYRIGHT AND LICENSE

Copyright (c) 2012 by Loïc TROCHET.

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

See http://dev.perl.org/licenses/ for more information.