exc_info
is something slightly different. It's the exception info if you are currently in an exception handler. Imagine this case:
try:
do_something_dangerous()
log.info("I did something dangerous, and it worked!") # 1
except SomethingBadHappened:
log.error("I did something dangerous, and it blew up!") # 2
In the #1 log statement, exc_info
will be empty, as there is no exception. But we will still gather a stack trace so you can see where exactly the log.info()
call happened.
In the #2 log statement, we actually capture two stack traces: one from where the exception was raised (2nd line in the example), and one from where log.error()
is called.
I just released version 3.0.1 of the agent, which supports the stack=False
flag for Logbook. So something like this
log.info("Nothing to see here", stack=False)
won't capture any stack trace anymore