logging: added some more logging statements

This commit is contained in:
A.M. Rowsell 2026-06-09 18:36:31 -04:00
commit 91c39042c8
Signed by: amr
GPG key ID: E0879EDBDB0CA7B1

View file

@ -164,6 +164,11 @@ class Discorss:
],
# "timestamp": str(self.now),
}
self.logger.debug(
"Checking for images in post %s from %s...",
latest_post["title"],
hook["name"],
)
image_url = self.get_image_url(latest_post)
if image_url is not None:
embed["thumbnail"] = {"url": image_url}
@ -303,7 +308,9 @@ class Discorss:
match = self.img_src_filter.search(str(text))
if match and self.is_image_url(match.group(1)):
image_candidates.append(match.group(1))
self.logger.debug("Found the following image candidates in %s...", feed["name"])
for i in image_candidates:
self.logger.debug("%s", i)
if len(image_candidates) > 0:
return image_candidates[0]
return None
@ -329,7 +336,7 @@ class Discorss:
logging.basicConfig(
filename=self.log_file_path,
encoding="utf-8",
level=logging.WARNING,
level=logging.ERROR,
datefmt="%m/%d/%Y %H:%M:%S",
format="%(asctime)s [%(threadName)s] -> %(levelname)s: %(message)s",
)