-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
enhancementNew feature or requestNew feature or requestopen for discussionCommunity feedback is wantedCommunity feedback is wanted
Description
Hi! I often use this library. It is very useful and I love it.
When the logger using JsonFormatter logs exceptions, the output is like this.
{
"asctime": "2024-12-16 16:29:19,170",
"levelname": "ERROR",
"name": "my-logger",
"message": "Unexpected Error",
"exc_info": "Traceback (most recent call last):\n File \"/Users/hakusai/src/hakusai/stacktrace-as-array/main.py\", line 20, in <module>\n do_something()\n File \"/Users/hakusai/src/hakusai/stacktrace-as-array/main.py\", line 14, in do_something\n raise Exception(\"something wrong\")\nException: something wrong"
}The stack trace is hard to read. It should be more readable like this.
{
"asctime": "2024-12-16 16:48:29,666",
"levelname": "ERROR",
"name": "my-logger",
"message": "Unexpected Error",
"exc_info": [
"Traceback (most recent call last):",
" File \"/Users/hakusai/src/hakusai/stacktrace-as-array/main.py\", line 20, in <module>",
" do_something()",
" File \"/Users/hakusai/src/hakusai/stacktrace-as-array/main.py\", line 14, in do_something",
" raise Exception(\"something wrong\")",
"Exception: something wrong"
]
}Proposal
- Add Option such like
stack_trace_as_arraytoJsonFormatter.- default:
Falsefor backward compatibility. - if
True, The formatter encodes stack traces as an array.
- default:
If you agree this feature, I will create PR.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestopen for discussionCommunity feedback is wantedCommunity feedback is wanted