You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get a lot of log spam in my logs about dates not matching the format string. Upon looking into it the code and the API specs, it looks like the order of formats could be reversed and the amount of log spam could be reduced. It appears that the /api/0.6/notes endpoint generates the "UTC" format, while the rest of the api endpoints generate ISO-8601 (2023-10-24T21:20:27Z) format dates.
The cleaner, slightly more complex solution would to not log an error unless both formats fail to match anything.
date_formats = ["%Y-%m-%d %H:%M:%S UTC", "%Y-%m-%dT%H:%M:%SZ"]
for date_format in date_formats:
try:
result = datetime.strptime(DateString, date_format)
return result
except (ValueError, TypeError):
logger.debug(f"{DateString} does not match {date_format}")
return DateString```
The text was updated successfully, but these errors were encountered:
But to be fair: those messages are marked "debug" for a reason, maybe you can adjust the logging level on your side. Or is there something important that you would miss (haven't checked the levels in quite some time)?
Completely fair. I considered turning down logs for that module, but thought the debug message might not be very useful if both formats exist and it only logs an error on the more common case. I'm not opposed to closing this out without changing anything. Just wanted to bring some light to it.
I get a lot of log spam in my logs about dates not matching the format string. Upon looking into it the code and the API specs, it looks like the order of formats could be reversed and the amount of log spam could be reduced. It appears that the /api/0.6/notes endpoint generates the "UTC" format, while the rest of the api endpoints generate ISO-8601 (2023-10-24T21:20:27Z) format dates.
The cleaner, slightly more complex solution would to not log an error unless both formats fail to match anything.
The text was updated successfully, but these errors were encountered: