3 ms·
logger.exception is basically a shortcut for logger.error(exc_info=True), so there's no need for explicitly assigning e as an error message.
by tmarice 5y ago
logger.exception is basically a shortcut for logger.error(exc_info=True), so there's no need for explicitly assigning e as an error message.
- aidos 5y agoAnd if you look carefully you’ll find that doing logger.exception(e) will just cast e as a string, which is just the message in the e. So you end up just sending the message twice (along with the stack trace). Instead you can do logger.exception(“something helpful to give a little more context at a glance”)