From 8e9b9529129e2cfbdf673762bf18c705423fb0c9 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 13 Mar 2017 12:49:06 +0100 Subject: Use Log::Any in script Signed-off-by: Florian Pritz --- script/borg-restore.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'script') diff --git a/script/borg-restore.pl b/script/borg-restore.pl index 9ae8d36..b55476b 100755 --- a/script/borg-restore.pl +++ b/script/borg-restore.pl @@ -166,6 +166,8 @@ use Cwd qw(abs_path); use File::Basename; use File::Spec; use Getopt::Long; +use Log::Any; +use Log::Any::Adapter; use Pod::Usage; my $app; @@ -195,6 +197,8 @@ sub user_select_archive { } sub main { + Log::Any::Adapter->set('Stderr', log_level => "warn"); + my %opts; # untaint PATH because we only expect this to run as root $ENV{PATH} = App::BorgRestore::Helper::untaint($ENV{PATH}, qr(.*)); @@ -205,6 +209,10 @@ sub main { GetOptions(\%opts, "help|h", "debug", "update-cache|u", "destination|d=s", "time|t=s") or pod2usage(2); pod2usage(0) if $opts{help}; + if ($opts{debug}) { + Log::Any::Adapter->set('Stderr', log_level => "debug"); + } + $app = App::BorgRestore->new(\%opts); if ($opts{"update-cache"}) { @@ -254,7 +262,7 @@ sub main { } } - $app->debug("Asked to restore $backup_path to $destination"); + $log->debug("Asked to restore $backup_path to $destination"); my $archives = $app->find_archives($backup_path); -- cgit v1.2.3-24-g4f1b