// in an action $this->logMessage($message, $level); // in a template <?php echo log_message($message, $level) ?>
例:
<code> // in a template <?php use_helper('Debug') ?> <?php echo log_message('{mainActions} been there', 'err') ?> // in an action $this->getLogger()->info($message); $this->getLogger()->err($message); $this->getLogger()->warning($message); // from anywhere in your application sfContext::getInstance()->getLogger()->info($message); sfContext::getInstance()->getLogger()->err($message); sfContext::getInstance()->getLogger()->warning($message); </code>
There are 8 levels of log messages:
emerg, alert, crit, err, warning, notice, info, debug
http://www.symfony-project.com/book/trunk/debug