From 68165c35caf205848c04dbbbbdc4ab65fe35f8d3 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 11 Dec 2024 15:18:26 +0100 Subject: [PATCH 1/2] context.php: fix log init --- inc/context.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/context.php b/inc/context.php index ee8dce7d..bbcfcfc5 100644 --- a/inc/context.php +++ b/inc/context.php @@ -42,9 +42,9 @@ function build_context(array $config): Context { // Check 'syslog' for backwards compatibility. if ((isset($config['syslog']) && $config['syslog']) || $backend === 'syslog') { - return new SyslogLogDriver($name, $level, $this->config['log_system']['syslog_stderr']); + return new SyslogLogDriver($name, $level, $config['log_system']['syslog_stderr']); } elseif ($backend === 'file') { - return new FileLogDriver($name, $level, $this->config['log_system']['file_path']); + return new FileLogDriver($name, $level, $config['log_system']['file_path']); } elseif ($backend === 'stderr') { return new StderrLogDriver($name, $level); } else { From a25f56e461cd6f925c445fe32a23f699ba4c8bdd Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 11 Dec 2024 15:34:51 +0100 Subject: [PATCH 2/2] context.php: report deprecation notice on syslog option --- inc/context.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/inc/context.php b/inc/context.php index bbcfcfc5..3e4169cb 100644 --- a/inc/context.php +++ b/inc/context.php @@ -40,9 +40,15 @@ function build_context(array $config): Context { $level = $config['debug'] ? LogDriver::DEBUG : LogDriver::NOTICE; $backend = $config['log_system']['type']; + $legacy_syslog = isset($config['syslog']) && $config['syslog']; + // Check 'syslog' for backwards compatibility. - if ((isset($config['syslog']) && $config['syslog']) || $backend === 'syslog') { - return new SyslogLogDriver($name, $level, $config['log_system']['syslog_stderr']); + if ($legacy_syslog || $backend === 'syslog') { + $log_driver = new SyslogLogDriver($name, $level, $config['log_system']['syslog_stderr']); + if ($legacy_syslog) { + $log_driver->log(LogDriver::NOTICE, 'The configuration setting \'syslog\' is deprecated. Please use \'log_system\' instead'); + } + return $log_driver; } elseif ($backend === 'file') { return new FileLogDriver($name, $level, $config['log_system']['file_path']); } elseif ($backend === 'stderr') {