diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-03-13 12:49:06 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-03-13 12:49:06 +0100 |
commit | 8e9b9529129e2cfbdf673762bf18c705423fb0c9 (patch) | |
tree | 2859b4ac5887f8bce37f44db8f95dcd7f9b772e4 /script | |
parent | 00c779c39d99bc046998866de83370f3c75b56d3 (diff) | |
download | App-BorgRestore-8e9b9529129e2cfbdf673762bf18c705423fb0c9.tar.gz App-BorgRestore-8e9b9529129e2cfbdf673762bf18c705423fb0c9.tar.xz |
Use Log::Any in script
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'script')
-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); |