【发布时间】:2012-02-14 14:44:22
【问题描述】:
我正在向一些处理异常的 python 代码添加日志记录,在下面的示例中,当发生 TypeError 或 AttributeError 时,想要记录异常详细信息(例如通过 logger.exception())的正确语法是什么?
try:
...
except (TypeError, AttributeError):
# want to do a logger.exception(x) here but not sure what to use for x
...
raise CustomError("Unable to parse column status)
【问题讨论】:
标签: python logging exception-handling