show run duration after each archived link in cli output

This commit is contained in:
Nick Sweeting 2021-04-10 07:52:01 -04:00
parent 6053f4e415
commit 62078a77f8
2 changed files with 6 additions and 3 deletions

View file

@ -379,7 +379,7 @@ def log_link_archiving_started(link: "Link", link_dir: str, is_new: bool):
pretty_path(link_dir),
))
def log_link_archiving_finished(link: "Link", link_dir: str, is_new: bool, stats: dict):
def log_link_archiving_finished(link: "Link", link_dir: str, is_new: bool, stats: dict, start_ts: datetime):
total = sum(stats.values())
if stats['failed'] > 0 :
@ -390,7 +390,9 @@ def log_link_archiving_finished(link: "Link", link_dir: str, is_new: bool, stats
_LAST_RUN_STATS.succeeded += 1
size = get_dir_size(link_dir)
print(' {black}{} files ({}){reset}'.format(size[2], printable_filesize(size[0]), **ANSI))
end_ts = datetime.now(timezone.utc)
duration = str(end_ts - start_ts).split('.')[0]
print(' {black}{} files ({}) in {}s {reset}'.format(size[2], printable_filesize(size[0]), duration, **ANSI))
def log_archive_method_started(method: str):