我添加记录到与异常交易一些Python代码,在下面什么为希望记录异常细节的正确语法的例子(例如,通过logger.exception())当一个类型错误或AttributeError的发生?Python异常日志记录,正确的语法?
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)
你试过了吗? – 2012-02-14 14:51:46