[pve-devel] [PATCH manager 1/6] vzdump: allow all defined log levels

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Sep 1 15:24:26 CEST 2017


this allows to pass also the 'warn' log level to this method.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/VZDump.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 004672d1..f29739bb 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -201,31 +201,33 @@ foreach my $plug (@pve_vzdump_classes) {
 my $debugstattxt = {
     err =>  'ERROR:',
     info => 'INFO:',
     warn => 'WARN:',
 };
 
 sub debugmsg {
     my ($mtype, $msg, $logfd, $syslog) = @_;
 
     chomp $msg;
 
     return if !$msg;
 
-    my $pre = $debugstattxt->{$mtype} || $debugstattxt->{'err'};
+    my $log_level = $debugstattxt->{$mtype} ? $mtype : 'err';
+
+    my $pre = $debugstattxt->{$log_level};
 
     my $timestr = strftime ("%F %H:%M:%S", CORE::localtime);
 
-    syslog ($mtype eq 'info' ? 'info' : 'err', "$pre $msg") if $syslog;
+    syslog ($log_level, "$pre $msg") if $syslog;
 
     foreach my $line (split (/\n/, $msg)) {
 	print STDERR "$pre $line\n";
 	print $logfd "$timestr $pre $line\n" if $logfd;
     }
 }
 
 sub run_command {
     my ($logfd, $cmdstr, %param) = @_;
 
     my $logfunc = sub {
 	my $line = shift;
 	debugmsg ('info', $line, $logfd);
-- 
2.11.0





More information about the pve-devel mailing list