def octario_excepthook(exc_type, exc_value, exc_traceback):
"""exception hook that sends OctarioException to log and other
exceptions to stderr (default excepthook)
"""
from octario.lib.exceptions import OctarioException
# sends full exception with trace to log
if not isinstance(exc_value, OctarioException):
return sys.__excepthook__(exc_type, exc_value, exc_traceback)
if LOG.getEffectiveLevel() <= logging.DEBUG:
formated_exception = "".join(
traceback.format_exception(exc_type, exc_value, exc_traceback))
LOG.error(formated_exception + exc_value.message)
else:
LOG.error(exc_value.message)
评论列表
文章目录