From a69acf171c86c3e521f4951197b15f94472c7d9a Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 18 Jan 2022 21:05:00 +0000 Subject: [PATCH] Fix logging --- gravesong.py | 7 ++++--- twi.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gravesong.py b/gravesong.py index 2e175d7..c560e22 100644 --- a/gravesong.py +++ b/gravesong.py @@ -1,5 +1,6 @@ import bs4 import executor +import logging import pypub import requests @@ -26,7 +27,7 @@ def process(metadata, output_dir): for paragraph in entry_content.children: if paragraph.name == "h1": - print(f"Gravesong - {chapter_title}") + logging.log(logging.INFO, f"Gravesong - {chapter_title}") book.add_chapter( pypub.create_chapter_from_string(chapter_content, chapter_title) ) @@ -34,8 +35,8 @@ def process(metadata, output_dir): elif paragraph.name == "p": chapter_content += paragraph.prettify() - print(f"Gravesong - {chapter_title}") + logging.log(logging.INFO, f"Gravesong - {chapter_title}") book.add_chapter(pypub.create_chapter_from_string(chapter_content, chapter_title)) - print("Gravesong - Book") + logging.log(logging.INFO, "Gravesong - Book") book.create_epub(output_dir) diff --git a/twi.py b/twi.py index 56829a6..35884ee 100644 --- a/twi.py +++ b/twi.py @@ -1,6 +1,7 @@ import asyncio -import executor import bs4 +import executor +import logging import pypub import requests @@ -25,12 +26,12 @@ def fetchVolume(title, metadata, volume_title, output_dir, links): for removed in div_remove: removed.decompose() - print(f"{title} - {chapter_title}") + logging.log(logging.INFO, f"{title} - {chapter_title}") book.add_chapter( pypub.create_chapter_from_string(chapter_content.prettify(), chapter_title) ) - print(f"{title} - {volume_title}") + logging.log(logging.INFO, f"{title} - {volume_title}") book.create_epub(output_dir)