/**
  * Start the debug trail
  */
 public function startDebug()
 {
     if ($this->modx->getOption('debug', $this->config, false)) {
         $mtime = microtime();
         $mtime = explode(" ", $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $this->debugTimeStart = $mtime;
         set_time_limit(0);
         $this->oldLogTarget = $this->modx->getLogTarget();
         $this->oldLogLevel = $this->modx->getLogLevel();
         $this->modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
         $logTarget = $this->modx->getOption('debugTarget', $this->config, '');
         if (!empty($logTarget)) {
             $this->modx->setLogTarget();
         }
     }
 }
Пример #2
0
 /**
  * Set the logging level for the topic.
  *
  * @access public
  * @param modRegister &$register
  * @param string $topic
  * @param int $level
  * @return boolean True if successful.
  */
 public function setLogging(modRegister &$register, $topic, $level = modX::LOG_LEVEL_ERROR) {
     $set = false;
     $this->_loggingRegister = &$register;
     if (isset($topic) && !empty($topic)) {
         $topic = trim($topic);
         if ($this->_loggingRegister->connect()) {
             $this->_prevLogTarget = $this->modx->getLogTarget();
             $this->_prevLogLevel = $this->modx->getLogLevel();
             $this->_loggingRegister->subscribe($topic);
             $this->_loggingRegister->setCurrentTopic($topic);
             $this->modx->setLogTarget($this->_loggingRegister);
             $this->modx->setLogLevel($level);
             $set = true;
         }
     }
     return $set;
 }