Пример #1
0
 /**
  * Generic logger
  * 
  * @see also Zend_Log::log()
  * 
  * @param string|Zend_Controller_Response_Http $input
  * @param int $priority
  * @param string $logType
  */
 public function writeLog($input, $priority = 7, $logType = NULL)
 {
     if (isset($logType)) {
         $this->logType = $logType;
     } else {
         $this->logType = $this->defaultLogType;
     }
     if ($input instanceof Zend_Controller_Response_Http) {
         $exceptions = $input->getException();
         foreach ($exceptions as $exception) {
             $message = $exception->getMessage();
             $extraFields = $this->getExtraFieldsArray($exception);
             parent::log($message, 2, $extraFields);
         }
     } else {
         $message = $input;
         parent::log($message, $priority, $this->getExtraFieldsArray());
     }
 }
Пример #2
0
 /**
  * Write log entry to DB
  *
  * @param string|Zend_Controller_Response_Http $input
  * @param int $priority
  * @param string $logType
  */
 public function writeLog($input, $priority = self::DEBUG, $logType = null)
 {
     if ($input instanceof HttpResponse) {
         $exceptions = $input->getException();
         foreach ($exceptions as $exception) {
             $message = $exception->getMessage();
             $extraFields = $this->_getExtraFieldsArray($exception);
             parent::log($message, self::CRIT, $extraFields);
         }
     } else {
         if ($input === null) {
             throw new Exception('unknown');
         }
         parent::log($input, $priority, $this->_getExtraFieldsArray($logType));
     }
 }