logging: Use logging.exception and exc_info for unexpected exceptions.

logging.exception() and logging.debug(exc_info=True),
etc. automatically include a traceback.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-06-11 16:35:37 -07:00
committed by Tim Abbott
parent 4b6d2cf25f
commit 1ed2d9b4a0
20 changed files with 71 additions and 58 deletions

View File

@@ -67,8 +67,8 @@ def get_expirable_session_var(session: Session, var_name: str, default_value: An
try:
value, expire_at = (session[var_name]['value'], session[var_name]['expire_at'])
except (KeyError, TypeError) as e:
logging.warning("get_expirable_session_var: Variable %s: %s", var_name, e)
except (KeyError, TypeError):
logging.warning("get_expirable_session_var: error getting %s", var_name, exc_info=True)
return default_value
if timestamp_to_datetime(expire_at) < timezone_now():