Log::Syslog::Fast::Simple - Wrapper around Log::Syslog::Fast that adds some
flexibility at the expense of additional runtime overhead.
use Log::Syslog::Fast::Simple;
# Simple usage:
$logger = Log::Syslog::Fast::Simple->new;
$logger->send("log message");
# More customized usage:
$logger = Log::Syslog::Fast::Simple->new(
loghost => 'myloghost',
port => 6666,
facility => LOG_LOCAL2,
severity => LOG_INFO,
sender => 'mymachine',
name => 'myapp',
);
$logger->send("log message", time, LOG_LOCAL3, LOG_DEBUG);
This module wraps Log::Syslog::Fast to provide a constructor with reasonable
defaults and a send() method that optionally accepts override
parameters for facility and severity.
- Log::Syslog::Fast::Simple->new(%params);
- Create a new Log::Syslog::Fast::Simple object with given parameters (may
be a hash or hashref). Takes the following named parameters which have the
same meaning as in Log::Syslog::Fast.
- proto
- Defaults to LOG_UDP
- loghost
- Defaults to 127.0.0.1
- port
- Defaults to 514
- facility
- Defaults to LOG_LOCAL0
- severity
- Defaults to LOG_INFO
- sender
- Defaults to Sys::Hostname::hostname
- name
- Defaults to a cleaned $0
- $logger->send($logmsg, [$time], [$severity], [$facility])
- Send a syslog message through the configured logger. If
$time is not provided, the current time is used.
If $severity or $facility
are not provided, the default provided at construction time is used.
Same as Log::Syslog::Fast.
Adam Thomason, <athomason@sixapart.com>
Copyright (C) 2009-2011 by Say Media, Inc.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.