Exemplo n.º 1
0
 /**
  * generateExceptionFile
  * @param Exception $exception
  * @return string
  */
 private function generateExceptionFile($exception)
 {
     $hash = md5($exception);
     $exceptionFilename = "exception-" . @date('Y-m-d-H-i-s') . "-{$hash}.html";
     foreach (new \DirectoryIterator($this->loggerDirectory) as $entry) {
         if (strpos($entry, $hash)) {
             $exceptionFilename = $entry;
             $saved = TRUE;
             break;
         }
     }
     $exceptionFilename = $this->loggerDirectory . '/' . $exceptionFilename;
     if (empty($saved) && ($logHandle = @fopen($exceptionFilename, 'w'))) {
         ob_start();
         // double buffer prevents sending HTTP headers in some PHP
         ob_start(function ($buffer) use($logHandle) {
             fwrite($logHandle, $buffer);
         }, 4096);
         Debugger::getBlueScreen()->render($exception);
         ob_end_flush();
         ob_end_clean();
         fclose($logHandle);
     }
     return $exceptionFilename;
 }
Exemplo n.º 2
0
 public static function initializePanel(Nette\Application\Application $application)
 {
     Nette\Diagnostics\Debugger::getBlueScreen()->addPanel(function ($e) use($application) {
         return $e ? NULL : array('tab' => 'Nette Application', 'panel' => '<h3>Requests</h3>' . Dumper::toHtml($application->getRequests()) . '<h3>Presenter</h3>' . Dumper::toHtml($application->getPresenter()));
     });
 }
Exemplo n.º 3
0
 public function register(DibiConnection $connection)
 {
     Debugger::getBar()->addPanel($this);
     Debugger::getBlueScreen()->addPanel(array(__CLASS__, 'renderException'));
     $connection->onEvent[] = array($this, 'logEvent');
 }
Exemplo n.º 4
0
 /**
  * @return Nette\Diagnostics\BlueScreen
  */
 private static function getDebuggerBlueScreen()
 {
     return method_exists('Nette\\Diagnostics\\Debugger', 'getBlueScreen') ? Debugger::getBlueScreen() : Debugger::$blueScreen;
 }
Exemplo n.º 5
0
 public function register(Dibi\Connection $connection)
 {
     Debugger::getBar()->addPanel($this);
     Debugger::getBlueScreen()->addPanel([__CLASS__, 'renderException']);
     $connection->onEvent[] = [$this, 'logEvent'];
 }
Exemplo n.º 6
0
 private function createLogger()
 {
     $reflection = new \ReflectionClass('Tracy\\Logger');
     if ($reflection->getConstructor() && $reflection->getConstructor()->getNumberOfParameters() > 0) {
         return new Logger(Tracy\Debugger::$logDirectory, Tracy\Debugger::$email, Nette\Diagnostics\Debugger::getBlueScreen());
     } else {
         return new Logger();
     }
 }