This commit is contained in:
Ayush Tiwari 2025-04-24 00:59:40 -07:00 committed by GitHub
commit 29c4656e32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View file

@ -36,7 +36,10 @@ class JsonFormatter(Formatter):
}
if record.exc_info:
json_record["stacktrace"] = self.formatException(record.exc_info)
try:
json_record["stacktrace"] = self.formatException(record.exc_info)
except Exception as e:
json_record["stacktrace"] = f"Error serializing stacktrace: {str(e)}"
return json.dumps(json_record)