You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not the best way to log an exception for two reasons:
% always formats the string, whether logger is configured to emit logs at error level or not
you miss out on the stack trace, which can be real handy for troubleshooting
logger.error("Connection failed: %s", ce) addresses (1) whilst ignoring (2). The logging module has the exc_info keyword argument, which pretty much will do this for you… I'd write the above as:
Also, small tip (which applies to
amqtt
in general too, I see the pattern there in lots of places):Not the best way to log an exception for two reasons:
%
always formats the string, whetherlogger
is configured to emit logs aterror
level or notlogger.error("Connection failed: %s", ce)
addresses (1) whilst ignoring (2). Thelogging
module has theexc_info
keyword argument, which pretty much will do this for you… I'd write the above as:Or, for
error
, there's a shortcut:Originally posted by @sjlongland in #75 (comment)
The text was updated successfully, but these errors were encountered: