From 27b5a8e4905746c365ea8d7fa076804a4440410b Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 May 2021 22:39:07 +0200 Subject: [PATCH] Rename log.action to log.status --- PFERD/crawl/crawler.py | 2 +- PFERD/logging.py | 6 +++--- PFERD/output_dir.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/PFERD/crawl/crawler.py b/PFERD/crawl/crawler.py index cefefad..d6d4abc 100644 --- a/PFERD/crawl/crawler.py +++ b/PFERD/crawl/crawler.py @@ -101,7 +101,7 @@ class CrawlToken(ReusableAsyncContextManager[ProgressBar]): bar_desc = f"[bold bright_cyan]Crawling[/] {escape(fmt_path(self._path))}" after_desc = f"[bold cyan]Crawled[/] {escape(fmt_path(self._path))}" - self._stack.callback(lambda: log.action(after_desc)) + self._stack.callback(lambda: log.status(after_desc)) await self._stack.enter_async_context(self._limiter.limit_crawl()) bar = self._stack.enter_context(log.crawl_bar(bar_desc)) diff --git a/PFERD/logging.py b/PFERD/logging.py index fc13e13..5025d88 100644 --- a/PFERD/logging.py +++ b/PFERD/logging.py @@ -55,7 +55,7 @@ class Log: # Whether different parts of the output are enabled or disabled self.output_explain = False - self.output_action = True + self.output_status = True self.output_report = True def _update_live(self) -> None: @@ -191,12 +191,12 @@ directly or as a GitHub issue: https://github.com/Garmelon/PFERD/issues/new if self.output_explain: self.print(f" {escape(text)}") - def action(self, text: str) -> None: + def status(self, text: str) -> None: """ Print a status update while crawling. Allows markup. """ - if self.output_action: + if self.output_status: self.print(text) def report(self, text: str) -> None: diff --git a/PFERD/output_dir.py b/PFERD/output_dir.py index cd68ead..17cb772 100644 --- a/PFERD/output_dir.py +++ b/PFERD/output_dir.py @@ -399,7 +399,7 @@ class OutputDirectory: async def _after_download(self, info: DownloadInfo) -> None: with self._ensure_deleted(info.tmp_path): - log.action(f"[bold cyan]Downloaded[/] {fmt_path(info.remote_path)}") + log.status(f"[bold cyan]Downloaded[/] {fmt_path(info.remote_path)}") log.explain_topic(f"Processing downloaded file for {fmt_path(info.path)}") changed = False @@ -430,10 +430,10 @@ class OutputDirectory: self._update_metadata(info) if changed: - log.action(f"[bold bright_yellow]Changed[/] {escape(fmt_path(info.path))}") + log.status(f"[bold bright_yellow]Changed[/] {escape(fmt_path(info.path))}") self._report.change_file(info.path) else: - log.action(f"[bold bright_green]Added[/] {escape(fmt_path(info.path))}") + log.status(f"[bold bright_green]Added[/] {escape(fmt_path(info.path))}") self._report.add_file(info.path) async def cleanup(self) -> None: @@ -463,7 +463,7 @@ class OutputDirectory: if await self._conflict_delete_lf(self._on_conflict, pure): try: path.unlink() - log.action(f"[bold bright_magenta]Deleted[/] {escape(fmt_path(pure))}") + log.status(f"[bold bright_magenta]Deleted[/] {escape(fmt_path(pure))}") self._report.delete_file(pure) except OSError: pass