Rename log.action to log.status

This commit is contained in:
Joscha 2021-05-23 22:39:07 +02:00
parent 1f400d5964
commit 27b5a8e490
3 changed files with 8 additions and 8 deletions

View File

@ -101,7 +101,7 @@ class CrawlToken(ReusableAsyncContextManager[ProgressBar]):
bar_desc = f"[bold bright_cyan]Crawling[/] {escape(fmt_path(self._path))}" bar_desc = f"[bold bright_cyan]Crawling[/] {escape(fmt_path(self._path))}"
after_desc = f"[bold cyan]Crawled[/] {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()) await self._stack.enter_async_context(self._limiter.limit_crawl())
bar = self._stack.enter_context(log.crawl_bar(bar_desc)) bar = self._stack.enter_context(log.crawl_bar(bar_desc))

View File

@ -55,7 +55,7 @@ class Log:
# Whether different parts of the output are enabled or disabled # Whether different parts of the output are enabled or disabled
self.output_explain = False self.output_explain = False
self.output_action = True self.output_status = True
self.output_report = True self.output_report = True
def _update_live(self) -> None: 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: if self.output_explain:
self.print(f" {escape(text)}") 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. Print a status update while crawling. Allows markup.
""" """
if self.output_action: if self.output_status:
self.print(text) self.print(text)
def report(self, text: str) -> None: def report(self, text: str) -> None:

View File

@ -399,7 +399,7 @@ class OutputDirectory:
async def _after_download(self, info: DownloadInfo) -> None: async def _after_download(self, info: DownloadInfo) -> None:
with self._ensure_deleted(info.tmp_path): 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)}") log.explain_topic(f"Processing downloaded file for {fmt_path(info.path)}")
changed = False changed = False
@ -430,10 +430,10 @@ class OutputDirectory:
self._update_metadata(info) self._update_metadata(info)
if changed: 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) self._report.change_file(info.path)
else: 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) self._report.add_file(info.path)
async def cleanup(self) -> None: async def cleanup(self) -> None:
@ -463,7 +463,7 @@ class OutputDirectory:
if await self._conflict_delete_lf(self._on_conflict, pure): if await self._conflict_delete_lf(self._on_conflict, pure):
try: try:
path.unlink() 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) self._report.delete_file(pure)
except OSError: except OSError:
pass pass