Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
will not have the same result if wrapper_class is not set ( and uses the default generic BoundLogger ) as it does when explicitly setting structlog.stdlib.BoundLogger.
I solved the issue in my code with this:
( The exception def is the same one in stdlib's BoundLogger. )
For me, this was kind of a big deal because I was rendering logs to JSON, and it ended up looking like this:
( Note the way the trace-back is just tacked onto the end of the JSON, thus rendering invalid JSON. )
After my fix, the JSON validates:
The above renders correctly with the default _generic.BoundLogger if I use this statement:
But I didn't want to force exc_info to be passed, or force logger.exception() not to be used. (And I wanted to use the default BoundLogger, if possible.)
Just so I understand you correctly: you want to wrap a standard lib logger (app.log), but you don't want to use structlog's stdlib.BoundLogger? Any specific reason?
I'm afraid changing the behavior of the vanilla BoundLogger would break b/w compatibility. Unless we make it a flag on instantiation I guess.