Example #1
0
 /**
  * Logs the message to the log with the given priority.
  *
  * This method only works if the Log Level is higher than the given priority.
  * If there is no logger object than this method will instantiate it.
  * In contrary to the debug statement this only logs strings.
  *
  * @param string $message  Element to log.
  * @param int    $priority Priority of the given log.
  *
  * @see DocBlock_Abstract::setLogLevel()
  * @see Zend_Log
  *
  * @return void
  */
 public function log($message, $priority = DocBlox_Core_Log::INFO)
 {
     if ($priority == DocBlox_Core_Log::DEBUG) {
         $this->debug($message);
         return;
     }
     if (!self::$logger || !self::$stdout_logger) {
         $config = $this->getConfig();
         // log to file
         self::$logger = new DocBlox_Core_Log($config->logging->paths->default);
         self::$logger->setThreshold($this->getLogLevel());
         // log to stdout
         self::$stdout_logger = new DocBlox_Core_Log(DocBlox_Core_Log::FILE_STDOUT);
         self::$stdout_logger->setThreshold($this->getLogLevel());
     }
     self::$logger->log($message, $priority);
     self::$stdout_logger->log($message, $priority);
 }