Added more debug information

This commit is contained in:
Frisk 2021-05-03 13:37:42 +02:00
parent f09862c277
commit ecaa2496dd
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
2 changed files with 3 additions and 0 deletions

View file

@ -77,6 +77,7 @@ def fetch_discussions():
for post in request_json: for post in request_json:
if int(post["id"]) > storage["discussion_id"]: if int(post["id"]) > storage["discussion_id"]:
try: try:
discussion_logger.debug(f"Sending discussion post with ID {post['id']}")
parse_discussion_post(post, comment_pages) parse_discussion_post(post, comment_pages)
except ArticleCommentError: except ArticleCommentError:
return None return None

View file

@ -47,6 +47,7 @@ class DataFile:
"""Data class which instance of is shared by multiple modules to remain consistent and do not cause too many IO operations.""" """Data class which instance of is shared by multiple modules to remain consistent and do not cause too many IO operations."""
def __init__(self): def __init__(self):
self.data = self.load_datafile() self.data = self.load_datafile()
misc_logger.debug("Current contents of data.json {}".format(self.data))
self.changed = False self.changed = False
@staticmethod @staticmethod
@ -79,6 +80,7 @@ class DataFile:
with open("data.json", "w") as data_file: with open("data.json", "w") as data_file:
data_file.write(json.dumps(self.data, indent=4)) data_file.write(json.dumps(self.data, indent=4))
self.changed = False self.changed = False
misc_logger.debug("Saving the database succeeded.")
except PermissionError: except PermissionError:
misc_logger.critical("Could not modify a data file (no permissions). No way to store last edit.") misc_logger.critical("Could not modify a data file (no permissions). No way to store last edit.")
sys.exit(1) sys.exit(1)