Пример #1
0
 public function log($message, $priority = self::INFO)
 {
     $parent = parent::log($message, $priority);
     $checked = array(self::CRITICAL, self::ERROR);
     if (defined('self::EXCEPTION')) {
         $checked[] = self::EXCEPTION;
     }
     if (in_array($priority, $checked, TRUE)) {
         $index = NULL;
         $trace = debug_backtrace(FALSE);
         if (!Tracy\Helpers::findTrace($trace, 'Tracy\\Debugger::log', $index)) {
             if (!Tracy\Helpers::findTrace($trace, 'Nette\\Diagnostics\\Debugger::log', $index)) {
                 Tracy\Helpers::findTrace($trace, 'log', $index);
             }
         }
         $errorTrace = $trace[$index + 1];
         //get trace for _errorHandler call
         $exceptionTrace = $trace[$index];
         //get trace for _exception or ::log call
         //if()
         $exception = NULL;
         if (isset($errorTrace['args']) && count($errorTrace['args']) == 5) {
             $exception = new \ErrorException($errorTrace['args'][1], 0, $errorTrace['args'][0], $errorTrace['args'][2], $errorTrace['args'][3]);
         } elseif (!empty($exceptionTrace['args']) && !empty($exceptionTrace['args'][0]) && $exceptionTrace['args'][0] instanceof \Exception) {
             $exception = $exceptionTrace['args'][0];
         }
         if ($exception) {
             $error = Consumerr::addError($exception);
             if ($error && is_array($message)) {
                 $error->addData('file', Tracy\Debugger::$logDirectory . '/' . substr($message[3], 5));
             }
         }
     }
     return $parent;
 }
Пример #2
0
 /**
  * @param Nette\Application\Application $app
  * @param \Exception $e
  */
 public function onError(Nette\Application\Application $app, \Exception $e)
 {
     if ($e instanceof Nette\Application\BadRequestException) {
         return;
     }
     Consumerr::addError($e);
 }