Closed
Description
Use case
When using the logger and logging an exception, the exception traceback appears as a single string that includes the stack trace, each frame of which has a file, a line number, a function name, and the statement on that line. Parsing that line, either with the Mk I eyeball or with code, is difficult
Solution/User Experience
Because logger is all about structured logging, it would be nice if the stack backtrace were structured as well. Something like:
Traceback = [
{
"File" : "myfile.py",
"Line" : 44,
"Function" : "do_something_risky",
"Statement": "do_division(x, 0)"
},
{
"File" : "myotherfile.py",
"Line": 12,
"Function" : "do_division",
"Statement" : "return numerator/denominator
}
]
Alternative solutions
There are no good ones that I'm aware of. I might be able to overload the existing functions in the traceback module, but doing that for every lambda function in my solution is not ideal
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Java, TypeScript
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped