【发布时间】:2011-03-17 11:16:38
【问题描述】:
我想在日志输出中包含调用记录器的类的名称,例如:
[MyClass] here is the message
我已经看到使用 Contexts 的选项,但我不想在我记录内容时在整个应用程序中执行类似的操作(请记住,我希望在每条日志消息中都使用类名) :
NDC.push('class:' + self.class.name)
logger.debug 'hello'
我只想打个电话:
logger.debug 'hello'
有什么建议吗?
【问题讨论】: