diff options
-rwxr-xr-x | script/borg-restore.pl | 10 |
1 files changed, 9 insertions, 1 deletions
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); |