]> git.proxmox.com Git - pve-manager.git/commitdiff
use log method from base VZDump::Plugin
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 13 Sep 2017 08:30:15 +0000 (10:30 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 22 Sep 2017 07:34:09 +0000 (09:34 +0200)
we copied our log method over there to resolve a cyclic dependency,
now use it here to reduce code duplication.
As we are below pve-guest-common in the dpendency hierachy we may use
it, but it does not may (or at least should) use us.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/VZDump.pm

index b6209765e8bc34ad0b076e5ef3d0dedf213150ed..a7e08fc8e8c939954b8faefc36d8f2e26e77153c 100644 (file)
@@ -4,11 +4,10 @@ use strict;
 use warnings;
 use Fcntl ':flock';
 use PVE::Exception qw(raise_param_exc);
-use PVE::SafeSyslog;
 use IO::File;
 use IO::Select;
 use IPC::Open3;
-use POSIX qw(strftime);
+use POSIX;
 use File::Path;
 use PVE::RPCEnvironment;
 use PVE::Storage;
@@ -18,6 +17,7 @@ use Time::Local;
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::HA::Env::PVE2;
 use PVE::HA::Config;
+use PVE::VZDump::Plugin;
 
 my @posix_filesystems = qw(ext3 ext4 nfs nfs4 reiserfs xfs);
 
@@ -198,29 +198,10 @@ foreach my $plug (@pve_vzdump_classes) {
 
 # helper functions
 
-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 $timestr = strftime ("%F %H:%M:%S", CORE::localtime);
-
-    syslog ($mtype eq 'info' ? 'info' : 'err', "$pre $msg") if $syslog;
-
-    foreach my $line (split (/\n/, $msg)) {
-       print STDERR "$pre $line\n";
-       print $logfd "$timestr $pre $line\n" if $logfd;
-    }
+    PVE::VZDump::Plugin::debugmsg(@_);
 }
 
 sub run_command {