]> git.proxmox.com Git - pve-common.git/commitdiff
syslog: interpret priority level 'warn' correctly
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 14 Jun 2023 13:05:58 +0000 (15:05 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Jun 2023 15:43:13 +0000 (17:43 +0200)
There are some use sites, e.g. HA manager, pvescheduler that
incorrectly use priority level 'warn'. Likely because that is allowed
for some other log helpers in the codebase. Instead of fixing them all
one-by-one, simply allow 'warn' as a priority too.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
src/PVE/SafeSyslog.pm

index 7d3e7a7a564e57fa9632a03e876c7d6826414fc2..af105a15d08536638bdd8a0dd31d6f1b5790764e 100644 (file)
@@ -18,7 +18,11 @@ my $log_tag = "unknown";
 # it corrupts the DBD database connection!
 
 sub syslog {
-    eval { Sys::Syslog::syslog (@_); }; # ignore errors
+    my ($level, @param) = @_;
+
+    $level = 'warning' if $level eq 'warn';
+
+    eval { Sys::Syslog::syslog ($level, @param); }; # ignore errors
 }
 
 sub initlog {