summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2019-10-09 11:55:41 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2019-10-09 11:55:41 (GMT)
commit0a916b8b229d6ffb6d4a1b821221ec16a3b5187f (patch) (side-by-side diff)
treee77e4ee6ee74b5915fb71e53c05c7bff2b17f109
parent3ba18dcf5581f79974ee1aadfe7dca20e2ea6a16 (diff)
downloadmojosyslog-0a916b8b229d6ffb6d4a1b821221ec16a3b5187f.tar.gz
mojosyslog-0a916b8b229d6ffb6d4a1b821221ec16a3b5187f.tar.bz2
Fix to work with Mojolicious 8.25
The version 8.25 introduces the "parent" keyword parameter to the Mojo::Log->new. When present it causes the constructor to return a clone of the parent logger. * lib/Mojo/Log/Syslog.pm (new): Special handling for the "parent" keyword argument. Extract syslog-specific parameters and pass the rest to the parent constructor verbatim.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/Mojo/Log/Syslog.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Mojo/Log/Syslog.pm b/lib/Mojo/Log/Syslog.pm
index 3e5992c..87b9013 100644
--- a/lib/Mojo/Log/Syslog.pm
+++ b/lib/Mojo/Log/Syslog.pm
@@ -11,16 +11,18 @@ our $VERSION = '1.01';
sub new {
my $class = shift;
local %_ = @_;
- my $ident = delete $_{ident} || basename($0);
- my $facility = delete $_{facility} || LOG_USER;
- my $level = delete $_{level} || 'debug';
- my $logopt = delete $_{logopt} || 'ndelay,pid';
- if (ref($logopt) eq 'ARRAY') {
- $logopt = join(',', @$logopt);
+
+ $_{level} ||= 'debug';
+ unless ($_{parent}) {
+ my $ident = delete $_{ident} || basename($0);
+ my $facility = delete $_{facility} || LOG_USER;
+ my $logopt = delete $_{logopt} || 'ndelay,pid';
+ if (ref($logopt) eq 'ARRAY') {
+ $logopt = join(',', @$logopt);
+ }
+ openlog($ident, $logopt, $facility);
}
- croak "unrecognized arguments" if keys(%_);
- openlog($ident, $logopt, $facility);
- return $class->SUPER::new(level => $level);
+ return $class->SUPER::new(%_);
}
sub debug { shift->_syslog(debug => LOG_DEBUG => @_) }

Return to:

Send suggestions and report system problems to the System administrator.