From a0f9d31d947c8d65bd4fbe02d707728269d39a0f Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Sun, 10 May 2020 21:53:24 +0200 Subject: [PATCH] Use PrettyLogger warning everywhere --- PFERD/ilias/crawler.py | 8 ++++---- PFERD/organizer.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PFERD/ilias/crawler.py b/PFERD/ilias/crawler.py index 8f48973..1a65ce4 100644 --- a/PFERD/ilias/crawler.py +++ b/PFERD/ilias/crawler.py @@ -163,7 +163,7 @@ class IliasCrawler: ) if modification_date_match is None: modification_date = None - LOGGER.warning("Could not extract start date from %r", all_properties_text) + PRETTY.warning(f"Could not extract start date from {all_properties_text!r}") else: modification_date_str = modification_date_match.group(1) modification_date = demangle_date(modification_date_str) @@ -203,14 +203,14 @@ class IliasCrawler: break if found_parent is None: - LOGGER.warning("Could not find element icon for %r", url) + PRETTY.warning(f"Could not find element icon for {url!r}") return [] # Find the small descriptive icon to figure out the type img_tag: Optional[bs4.Tag] = found_parent.select_one("img.ilListItemIcon") if img_tag is None: - LOGGER.warning("Could not find image tag for %r", url) + PRETTY.warning(f"Could not find image tag for {url!r}") return [] # A forum @@ -319,7 +319,7 @@ class IliasCrawler: json_match = regex.search(str(video_page_soup)) if json_match is None: - LOGGER.warning("Could not find json stream info for %r", video_page_url) + PRETTY.warning(f"Could not find json stream info for {video_page_url!r}") return [] json_str = json_match.group(1) diff --git a/PFERD/organizer.py b/PFERD/organizer.py index 4570957..ca4b79c 100644 --- a/PFERD/organizer.py +++ b/PFERD/organizer.py @@ -46,7 +46,7 @@ class Organizer(Location): LOGGER.debug("Copying %s to %s", src_absolute, dst_absolute) if self._is_marked(dst): - LOGGER.warning("File %r was already written!", str(dst_absolute)) + PRETTY.warning(f"File {str(dst_absolute)!r} was already written!") if not prompt_yes_no(f"Overwrite file?", default=False): PRETTY.ignored_file(dst_absolute, "file was written previously") return @@ -56,7 +56,7 @@ class Organizer(Location): if prompt_yes_no(f"Overwrite folder {dst_absolute} with file?", default=False): shutil.rmtree(dst_absolute) else: - LOGGER.warning("Could not add file %s", dst_absolute) + PRETTY.warning(f"Could not add file {str(dst_absolute)!r}") return # Destination file exists