azuma, kuniyuki > Haineko-0.2.16 > Haineko::Log

Download:
Haineko-0.2.16.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Haineko::Log - Syslog interface

DESCRIPTION ^

Write log messages via UNIX syslog

SYNOPSIS ^

    use Haineko::Log;
    my $v = { 
        'remoteaddr' => '127.0.0.1', 
        'remoteport' => 1024, 
    };
    my $e = Haineko::Log->new( %$v );
    my $x = { 'message' => 'Log message' };
    $e->w( 'info', $x );
    # Jul  4 10:00:00 host haineko[6994]: client=127.0.0.1:1024, message='Log message'

    $x = { 'message' => 'Rejected', 'dsn' => '5.2.1', 'code' => 550 };
    $e->w( 'err', $x );
    # Jul  4 10:00:00 host haineko[6994]: client=127.0.0.1:1024, message='Rejected', dsn=5.2.1, code=550

    $v = { 'remoteaddr' => '192.0.1.2', 'queueid' => 'r67HY3E06994bogA' };
    $e = Haineko::Log->new( %$v );
    $x = { 'message' => [ 'Log1', 'Log2' ] 'neko' => 'Nyaa' };
    $e->w( 'err', $x );
    # Jul  4 10:00:00 host haineko[6994]: queueid=r67HY3E06994bogA, client=192.0.2.1, message='Log1 | Log2', neko=Nyaa

CLASS METHODS ^

new( %arguments )

new() is a constructor of Haineko::Log

    my $e = Haineko::Log->new(
            'queueid' => 'ID string',   # Haineko::SMTPD::Session->queueid
            'useragent' => 'Agent name',    # $self->req->header->user_agent
            'remoteaddr' => '127.0.0.1',    # REMOTE_HOST http environment variable
            'remoteport' => 1024,       # REMOTE_PORT http environment variable
    );

INSTANCE METHODS ^

w( log-level, argument)

w() write log messages via UNIX syslog

    my $e = Haineko:::Log->new( %argvs );
    my $m = { 'message' => 'error', 'cat' => 'kijitora' };
    $e->w( 'err', $m );

REPOSITORY ^

https://github.com/azumakuniyuki/Haineko

AUTHOR ^

azumakuniyuki <perl.org [at] azumakuniyuki.org>

LICENSE ^

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

syntax highlighting: