summaryrefslogtreecommitdiff
path: root/obnamlib/backup_progress.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-11-06 11:51:50 +0000
committerLars Wirzenius <liw@liw.fi>2015-11-06 11:51:50 +0000
commit452dee9d2e5e1d1ae13a45a5bb2854f7903e445c (patch)
treee8b0d05941236f6fd9dd988c5e9a021dad164e5b /obnamlib/backup_progress.py
parentee286a74d3fdf4c65f5dd1f80c02d5d23aa0a481 (diff)
downloadobnam-452dee9d2e5e1d1ae13a45a5bb2854f7903e445c.tar.gz
Make --quiet stop end-of-backup statistics to stdout
Diffstat (limited to 'obnamlib/backup_progress.py')
-rw-r--r--obnamlib/backup_progress.py53
1 files changed, 28 insertions, 25 deletions
diff --git a/obnamlib/backup_progress.py b/obnamlib/backup_progress.py
index 6b98c8fd..97129b9d 100644
--- a/obnamlib/backup_progress.py
+++ b/obnamlib/backup_progress.py
@@ -93,7 +93,7 @@ class BackupProgress(object):
def update_progress_with_removed_checkpoint(self, gen):
self._ts['checkpoint'] = gen
- def report_stats(self, output, fs):
+ def report_stats(self, output, fs, quiet):
duration = time.time() - self.started
duration_string = obnamlib.humanise_duration(duration)
@@ -147,27 +147,30 @@ class BackupProgress(object):
scanned_amount, scanned_unit = obnamlib.humanise_size(
self.scanned_bytes)
- output.write(
- 'Backed up %d files (of %d found), containing %.1f %s.\n' %
- (self.backed_up_count,
- self.file_count,
- scanned_amount,
- scanned_unit))
- output.write(
- 'Uploaded %.1f %s file data in %s at %.1f %s average speed.\n' %
- (chunk_amount,
- chunk_unit,
- duration_string,
- speed_amount,
- speed_unit))
- output.write(
- 'Total download amount %.1f %s.\n' %
- (dl_amount,
- dl_unit))
- output.write(
- 'Total upload amount %.1f %s. Overhead was %.1f %s (%.1f %%).\n' %
- (ul_amount,
- ul_unit,
- overhead_amount,
- overhead_unit,
- overhead_percent))
+ if not quiet:
+ output.write(
+ 'Backed up %d files (of %d found), containing %.1f %s.\n' %
+ (self.backed_up_count,
+ self.file_count,
+ scanned_amount,
+ scanned_unit))
+ output.write(
+ 'Uploaded %.1f %s file data in %s at %.1f %s '
+ 'average speed.\n' %
+ (chunk_amount,
+ chunk_unit,
+ duration_string,
+ speed_amount,
+ speed_unit))
+ output.write(
+ 'Total download amount %.1f %s.\n' %
+ (dl_amount,
+ dl_unit))
+ output.write(
+ 'Total upload amount %.1f %s. '
+ 'Overhead was %.1f %s (%.1f %%).\n' %
+ (ul_amount,
+ ul_unit,
+ overhead_amount,
+ overhead_unit,
+ overhead_percent))