add timestamp to error logging
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user