logging: added some more logging statements
This commit is contained in:
parent
acb03cff27
commit
91c39042c8
1 changed files with 9 additions and 2 deletions
11
discorss.py
11
discorss.py
|
|
@ -164,6 +164,11 @@ class Discorss:
|
||||||
],
|
],
|
||||||
# "timestamp": str(self.now),
|
# "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)
|
image_url = self.get_image_url(latest_post)
|
||||||
if image_url is not None:
|
if image_url is not None:
|
||||||
embed["thumbnail"] = {"url": image_url}
|
embed["thumbnail"] = {"url": image_url}
|
||||||
|
|
@ -303,7 +308,9 @@ class Discorss:
|
||||||
match = self.img_src_filter.search(str(text))
|
match = self.img_src_filter.search(str(text))
|
||||||
if match and self.is_image_url(match.group(1)):
|
if match and self.is_image_url(match.group(1)):
|
||||||
image_candidates.append(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:
|
if len(image_candidates) > 0:
|
||||||
return image_candidates[0]
|
return image_candidates[0]
|
||||||
return None
|
return None
|
||||||
|
|
@ -329,7 +336,7 @@ class Discorss:
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
filename=self.log_file_path,
|
filename=self.log_file_path,
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
level=logging.WARNING,
|
level=logging.ERROR,
|
||||||
datefmt="%m/%d/%Y %H:%M:%S",
|
datefmt="%m/%d/%Y %H:%M:%S",
|
||||||
format="%(asctime)s [%(threadName)s] -> %(levelname)s: %(message)s",
|
format="%(asctime)s [%(threadName)s] -> %(levelname)s: %(message)s",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue