[pve-devel] [PATCH guest-common 3/6] vzdump: add common log submethod

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


Add a general log method here which supports to pass on the "log to
syslog too" functionallity and makes it more clearn what each param
of logerr and logginfo means.
Further we can now also log wlith a 'warn' level, which can be
useful to notice an backup user of a possible problem which isn't a
error per se.

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

diff --git a/PVE/VZDump/Plugin.pm b/PVE/VZDump/Plugin.pm
index 9891352..7a8c0b5 100644
--- a/PVE/VZDump/Plugin.pm
+++ b/PVE/VZDump/Plugin.pm
@@ -25,16 +25,22 @@ sub cmd_noerr {
     return $res;
 }
 
+sub log {
+    my ($self, $level, $msg, $syslog) = @_;
+
+    PVE::VZDump::debugmsg($level, $msg, $self->{logfd}, $syslog);
+}
+
 sub loginfo {
     my ($self, $msg) = @_;
 
-    PVE::VZDump::debugmsg('info', $msg, $self->{logfd}, 0);
+    $self->log('info', $msg, $self->{logfd}, 0);
 }
 
 sub logerr {
     my ($self, $msg) = @_;
 
-    PVE::VZDump::debugmsg('err', $msg, $self->{logfd}, 0);
+    $self->log('err', $msg, $self->{logfd}, 0);
 }
 
 sub type {
-- 
2.11.0





More information about the pve-devel mailing list