From da1969b1036c0e21248f22da53a3163cd8f89833 Mon Sep 17 00:00:00 2001 From: Ching L Date: Mon, 7 Apr 2025 11:33:28 +0800 Subject: [PATCH] fix(crawler): replace print statements with logger for better logging Updated the crawler to use the logger for outputting article information and toot notifications, enhancing the logging mechanism for improved monitoring and debugging. --- crawler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crawler.py b/crawler.py index e51dbf7..645074a 100644 --- a/crawler.py +++ b/crawler.py @@ -91,7 +91,7 @@ def crawler(): # save the article info to redis if save_to_redis(article): - print(article) + logger.info(article) def toot(): # get all the keys in redis @@ -117,6 +117,7 @@ def toot(): url=article['url']) mastodon_client.status_post(toot_content, media_ids=[media['id']]) + logger.info('Toot %s' % article['title']) # add the article['id'] to the set redis_db.sadd('send-chh-article-id', article['article_id'])