NAME

Log::Dispatch::UnixSyslog - log events to syslog with Unix::Syslog

VERSION

version 0.001

SYNOPSIS

use Log::Dispatch;
use Log::Dispatch::UnixSyslog;

my $log = Log::Dispatch->new;

$log->add(
  Log::Dispatch::UnixSyslog->new(
    ident => 'super-cool-daemon',
    min_level => 'debug',
    flush_if  => sub { (shift)->event_count >= 60 },
  )
);

while (@events) {
  $log->warn($_);
}

DESCRIPTION

This provides a Log::Dispatch log output plugin that sends things to syslog. "But there's already Log::Dispatch:Syslog!" you cry. Well, that uses Sys::Syslog, which is core, but it's overcomplicated and inefficient, too. This plugin uses Unix::Syslog, which does a lot less, and should be more efficient at doing it.

METHODS

new

my $output = Log::Dispatch::UnixSyslog->new(\%arg);

This method constructs a new Log::Dispatch::UnixSyslog output object. In addition to the standard parameters documented in Log::Dispatch::Output, this takes the following arguments:

ident     - a string to prepend to all messages in the system log; required
facility  - which syslog facility to log to (as a string); required
logopt    - the numeric value of the openlog options parameter; (default: 0)

log_message

This is the method which performs the actual logging, as detailed by Log::Dispatch::Output.

AUTHOR

Ricardo SIGNES <rjbs@semiotic.systems>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Ricardo SIGNES.

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