summaryrefslogtreecommitdiffstats
path: root/lib/App
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-04-05 18:05:40 +0200
committerFlorian Pritz <bluewind@xinu.at>2017-04-05 18:05:40 +0200
commit406b25785ed4e2f5872f1a6ede29b612bf3ce2c1 (patch)
treed95a66c8b058565310c8efc7c7dcffec37a99db3 /lib/App
parent13d43df3a816f79ac75d3cb71a45bfcb73ad1484 (diff)
downloadApp-BorgRestore-406b25785ed4e2f5872f1a6ede29b612bf3ce2c1.tar.gz
App-BorgRestore-406b25785ed4e2f5872f1a6ede29b612bf3ce2c1.tar.xz
Add debug output to Borg package
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App')
-rw-r--r--lib/App/BorgRestore/Borg.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm
index 38c12ae..402dba3 100644
--- a/lib/App/BorgRestore/Borg.pm
+++ b/lib/App/BorgRestore/Borg.pm
@@ -4,6 +4,7 @@ use warnings;
use strict;
use IPC::Run qw(run start new_chunker);
+use Log::Any qw($log);
sub new {
my $class = shift;
@@ -21,6 +22,7 @@ sub borg_list {
my $self = shift;
my @archives;
+ $log->debug("Getting archive list");
run [qw(borg list), $self->{borg_repo}], '>', \my $output or die "borg list returned $?";
for (split/^/, $output) {
@@ -38,6 +40,7 @@ sub restore {
my $archive_name = shift;
my $path = shift;
+ $log->debugf("Restoring '%s' from archive %s, stripping %d components of the path", $path, $archive_name, $components_to_strip);
system(qw(borg extract -v --strip-components), $components_to_strip, $self->{borg_repo}."::".$archive_name, $path);
}
@@ -46,6 +49,7 @@ sub list_archive {
my $archive = shift;
my $cb = shift;
+ $log->debugf("Fetching file list for archive %s", $archive);
open (my $fh, '-|', 'borg', qw/list --list-format/, '{isomtime} {path}{NEWLINE}', $self->{borg_repo}."::".$archive);
while (<$fh>) {
$cb->($_);