add timestamp to error logging

This commit is contained in:
muskit
2024-01-26 23:43:11 -08:00
parent 9730f26cb6
commit 39cd02bce2
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -67,6 +67,7 @@ async def get_cross_tweets_online():
print("Unhandled error occurred while pulling tweets.")
traceback.print_exc()
with open(working_path(file="error_catchup.txt"), "a") as f:
f.write(f"-------[{get_current_datetime_pretty()}]-------\n")
f.write(f"Error getting tweets from user {dbg_curr_user}\n")
traceback.print_exc(file=f)
safe_to_post_tweets = False
+4
View File
@@ -61,6 +61,10 @@ def get_current_date():
return datetime.today().strftime("%Y-%m-%d")
def get_current_datetime_pretty():
return datetime.now().strftime("%Y-%m-%d %H:%M:%S %Z")
def get_key_from_value(d: dict, val):
keys = [k for k, v in d.items() if v == val]
if keys: