@contextmanager
def exception_logging(logger, msg):
 try:
  (yield)
 except Exception:
  logger.exception(msg)
  raise

@ contextmanager def exception_logging ( logger , msg ) : try : ( yield ) except Exception : logger . exception ( msg ) raise
provides exception logging via logger .