Subject: | Log::Dispatch::Syslog doesn't support remote rsyslogd logging |
Date: | Fri, 14 Feb 2014 17:43:49 -0500 |
To: | bug-Log-Dispatch [...] rt.cpan.org |
From: | David Coppit <david [...] coppit.org> |
As of version 0.28 of Sys::Syslog, clients can pass a hash reference that
allows one to specify parameters for remote logging.
The patch below adds support for this feature in Log::Dispatch::Syslog.
--- /root/Syslog.pm.old 2014-02-14 22:30:50.364721315 +0000
+++ /usr/share/perl5/vendor_perl/Log/Dispatch/Syslog.pm 2014-02-14
22:36:27.792696610 +0000
@@ -10,7 +10,7 @@
use base qw( Log::Dispatch::Output );
-use Params::Validate qw(validate ARRAYREF SCALAR);
+use Params::Validate qw(validate ARRAYREF HASHREF SCALAR);
Params::Validate::validation_options( allow_extra => 1 );
use Sys::Syslog 0.16 ();
@@ -49,7 +49,7 @@
default => 'user'
},
socket => {
- type => SCALAR | ARRAYREF,
+ type => SCALAR | ARRAYREF | HASHREF,
default => undef
},
}
@@ -72,7 +72,8 @@
];
Sys::Syslog::setlogsock(
- ref $self->{socket} ? @{ $self->{socket} } : $self->{socket} )
+ ref $self->{socket} eq 'ARRAY' ? @{ $self->{socket} } :
+ $self->{socket} )
if defined $self->{socket};
}
@@ -170,7 +171,8 @@
portable.
If you pass an array reference, it is dereferenced and passed to
-C<Sys::Syslog::setlogsock()>.
+C<Sys::Syslog::setlogsock()>. If you pass a hash reference, it is
+passed directly to C<Sys::Syslog::setlogsock()>.
=back