在Java中,我使用log4J作为日志框架.在Log4j中,您可以执行以下操作:
if (log.isDebug()) { // do some expensive operation that should only be displayed if DEBUG is turned on }
阅读一些Symfony示例,我无法找到确定是否在当前类上下文中激活DEBUG日志记录的方法.有没有办法做到这一点?
if (--need something here--) { $this->logMessage('Expensive operation return value: '.expensiveFunction(), 'debug'); }
ax... 5
就像是
$this->getLogger()->getLogLevel() == sfLogger::DEBUG
应该做.
就像是
$this->getLogger()->getLogLevel() == sfLogger::DEBUG
应该做.