public static function initialize() { $blueScreen = Tracy\Debugger::getBlueScreen(); if (preg_match('#(.+)/Bridges/Framework$#', strtr(__DIR__, '\\', '/'), $m)) { if (preg_match('#(.+)/nette/bootstrap/src$#', $m[1], $m2)) { $blueScreen->collapsePaths[] = "{$m2['1']}/nette"; $blueScreen->collapsePaths[] = "{$m2['1']}/latte"; } else { $blueScreen->collapsePaths[] = $m[1]; } } if (class_exists('Nette\\Framework')) { $bar = Tracy\Debugger::getBar(); $bar->info[] = $blueScreen->info[] = 'Nette Framework ' . Nette\Framework::VERSION . ' (' . Nette\Framework::REVISION . ')'; } $blueScreen->addPanel(function ($e) { if ($e instanceof Latte\CompileException) { return array('tab' => 'Template', 'panel' => '<p>' . (is_file($e->sourceName) ? '<b>File:</b> ' . Helpers::editorLink($e->sourceName, $e->sourceLine) : htmlspecialchars($e->sourceName)) . '</p>' . ($e->sourceCode ? '<pre>' . BlueScreen::highlightLine(htmlspecialchars($e->sourceCode), $e->sourceLine) . '</pre>' : '')); } elseif ($e instanceof Nette\Neon\Exception && preg_match('#line (\\d+)#', $e->getMessage(), $m)) { if ($item = Helpers::findTrace($e->getTrace(), 'Nette\\DI\\Config\\Adapters\\NeonAdapter::load')) { return array('tab' => 'NEON', 'panel' => '<p><b>File:</b> ' . Helpers::editorLink($item['args'][0], $m[1]) . '</p>' . BlueScreen::highlightFile($item['args'][0], $m[1])); } elseif ($item = Helpers::findTrace($e->getTrace(), 'Nette\\Neon\\Decoder::decode')) { return array('tab' => 'NEON', 'panel' => BlueScreen::highlightPhp($item['args'][0], $m[1])); } } }); }
public function __construct($slackUrl, IMessageFactory $messageFactory, $timeout) { parent::__construct(Debugger::$logDirectory, Debugger::$email, Debugger::getBlueScreen()); $this->slackUrl = $slackUrl; $this->messageFactory = $messageFactory; $this->timeout = $timeout; }
/** * render. * * @method render * * @param \Exception $exception * * @return string */ public function render(Exception $exception) { $exception = $this->fixStack($exception, error_get_last()); ob_start(); Helpers::improveException($exception); Debugger::getBlueScreen()->render($exception); return ob_get_clean(); }
public static function getBlueScreen($e) { ob_start(); TracyDebugger::getBlueScreen()->render($e); $content = ob_get_clean(); $content = static::updateEditorUri($content); return $content; }
/** * render. * * @method render * * @param \Exception $exception * * @return string */ public function render(Exception $exception, $error = null) { $error = is_null($error) === true ? error_get_last() : $error; $exception = $this->fixStack($exception, $error); ob_start(); Helpers::improveException($exception); Debugger::getBlueScreen()->render($exception); return ob_get_clean(); }
public function __construct($slackUrl, $logUrl, $channel = NULL, $username = NULL, $icon = NULL, $pretext = NULL) { parent::__construct(Debugger::$logDirectory, Debugger::$email, Debugger::getBlueScreen()); $this->slackUrl = $slackUrl; $this->logUrl = $logUrl; $this->channel = $channel; $this->username = $username; $this->icon = $icon; $this->pretext = $pretext; }
public static function initializePanel(Nette\Application\Application $application) { Tracy\Debugger::getBlueScreen()->addPanel(function ($e) use ($application) { return $e ? NULL : array( 'tab' => 'Nette Application', 'panel' => '<h3>Requests</h3>' . Tracy\Dumper::toHtml($application->getRequests()) . '<h3>Presenter</h3>' . Tracy\Dumper::toHtml($application->getPresenter()), ); }); }
public function __construct(Monolog\Logger $monolog) { $this->monolog = $monolog; // BC with Nette if (interface_exists('Tracy\\ILogger') && method_exists($this, 'logException')) { parent::__construct(Debugger::$logDirectory, Debugger::$email, Debugger::getBlueScreen()); } $this->directory =& Debugger::$logDirectory; $this->email =& Debugger::$email; }
/** * @param string $apiToken * @param string $room */ public function __construct($apiToken, $room, $filters = [], $linkToLogFileFactory = NULL) { $reflection = new \ReflectionClass('Tracy\\Logger'); if ($reflection->getConstructor()) { parent::__construct(Tracy\Debugger::$logDirectory, Tracy\Debugger::$email, Tracy\Debugger::getBlueScreen()); } else { $this->directory = Tracy\Debugger::$logDirectory; $this->email = Tracy\Debugger::$email; } $this->linkToLogFileFactory = $linkToLogFileFactory; $this->logger = new Vysinsky\HipChat\Logger($apiToken, $room, $filters); }
/** * @return BlueScreen */ public static function getBlueScreen() { if (!self::$blueScreen || !parent::getBlueScreen() instanceof BlueScreen) { if (!self::$blueScreen) { self::$blueScreen = new BlueScreen(); self::$blueScreen->info = ['PHP ' . PHP_VERSION, isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : NULL, 'Tracy ' . self::VERSION]; } $reflection = new \ReflectionClass(static::class); $tracyDebugger = $reflection->getParentClass(); $tracyDebuggerBlueScreen = $tracyDebugger->getProperty('blueScreen'); $tracyDebuggerBlueScreen->setAccessible(TRUE); $tracyDebuggerBlueScreen->setValue(NULL, self::$blueScreen); } return self::$blueScreen; }
public function beforeCompile() { $config = $this->getConfig(); if (count($config) !== 1 || !isset($config[0])) { throw new ConfigVersionExtension("Version number not set in config.local.neon. Add this root key: 'version: [1]' to your local config."); } $old = $config[0]; $raw = file_get_contents($this->getContainerBuilder()->expand(static::$samplePath)); $sample = Neon::decode($raw); if (!isset($sample['version'][0]) || count($sample['version']) !== 1) { throw new ConfigVersionExtension("Version number not set in sample config. Add this root key: 'version: [1]' to your sample config."); } $new = $sample['version'][0]; if ($old !== $new) { Debugger::getBlueScreen()->addPanel($this->getBlueScreenPanelCallback()); throw new ConfigVersionExtension('Sample config neon is not compatible with your current local config. Update your local config according to the diff below.'); } }
/** * SentryLogger constructor. * @param $dsn * @param bool $inDebug * @param null $directory * @param null $email * @param bool $autoWire * @param array $options */ public function __construct($dsn, $inDebug = false, $directory = null, $email = null, $autoWire = true, $options = []) { // Compability with nette 2.2.0, Tracy\Logger has no __construct in 2.2.0 if ((new \ReflectionClass('Tracy\\Logger'))->getConstructor()) { parent::__construct($directory, $email, Debugger::getBlueScreen()); } //Check for production mode, you will want to fllod sentry only in production... right ? $this->enabled = Debugger::$productionMode || $inDebug; $this->raven = new \Raven_Client($dsn, $options); if ($autoWire) { //Add sentryNetteLogger to tracy $that = $this; Debugger::$onFatalError[] = function ($e) use($that) { $that->onFatalError($e); }; // Add logger to tracy Debugger::setLogger($this); } }
public static function initialize() { $bar = Tracy\Debugger::getBar(); $bar->info[] = 'Nette Framework ' . Nette\Framework::VERSION . ' (' . substr(Nette\Framework::REVISION, 8) . ')'; $blueScreen = Tracy\Debugger::getBlueScreen(); $blueScreen->collapsePaths[] = dirname(dirname(__DIR__)); $blueScreen->info[] = 'Nette Framework ' . Nette\Framework::VERSION . ' (revision ' . Nette\Framework::REVISION . ')'; $blueScreen->addPanel(function ($e) { if ($e instanceof Latte\CompileException) { return array('tab' => 'Template', 'panel' => '<p>' . (is_file($e->sourceName) ? '<b>File:</b> ' . Helpers::editorLink($e->sourceName, $e->sourceLine) : htmlspecialchars($e->sourceName)) . '</p>' . ($e->sourceCode ? '<pre>' . BlueScreen::highlightLine(htmlspecialchars($e->sourceCode), $e->sourceLine) . '</pre>' : '')); } elseif ($e instanceof Nette\Utils\NeonException && preg_match('#line (\\d+)#', $e->getMessage(), $m)) { if ($item = Helpers::findTrace($e->getTrace(), 'Nette\\DI\\Config\\Adapters\\NeonAdapter::load')) { return array('tab' => 'NEON', 'panel' => '<p><b>File:</b> ' . Helpers::editorLink($item['args'][0], $m[1]) . '</p>' . BlueScreen::highlightFile($item['args'][0], $m[1])); } elseif ($item = Helpers::findTrace($e->getTrace(), 'Nette\\Utils\\Neon::decode')) { return array('tab' => 'NEON', 'panel' => BlueScreen::highlightPhp($item['args'][0], $m[1])); } } }); }
public static function initialize() { $blueScreen = Tracy\Debugger::getBlueScreen(); if (class_exists('Nette\\Framework')) { $version = Framework::VERSION . (Framework::REVISION ? ' (' . Framework::REVISION . ')' : ''); Tracy\Debugger::getBar()->getPanel('Tracy:info')->data['Nette Framework'] = $version; $blueScreen->info[] = "Nette Framework {$version}"; } $blueScreen->addPanel(function ($e) { if ($e instanceof Latte\CompileException) { return ['tab' => 'Template', 'panel' => (@is_file($e->sourceName) ? '<p><b>File:</b> ' . Helpers::editorLink($e->sourceName, $e->sourceLine) . '</p>' : '') . '<pre>' . BlueScreen::highlightLine(htmlspecialchars($e->sourceCode, ENT_IGNORE, 'UTF-8'), $e->sourceLine) . '</pre>']; } }); $blueScreen->addPanel(function ($e) { if ($e instanceof Nette\Neon\Exception && preg_match('#line (\\d+)#', $e->getMessage(), $m) && ($trace = Helpers::findTrace($e->getTrace(), 'Nette\\Neon\\Decoder::decode'))) { return ['tab' => 'NEON', 'panel' => ($trace2 = Helpers::findTrace($e->getTrace(), 'Nette\\DI\\Config\\Adapters\\NeonAdapter::load')) ? '<p><b>File:</b> ' . Helpers::editorLink($trace2['args'][0], $m[1]) . '</p>' . BlueScreen::highlightFile($trace2['args'][0], $m[1]) : BlueScreen::highlightPhp($trace['args'][0], $m[1])]; } }); }
public function __construct($slackUrl, $logUrl) { parent::__construct(Debugger::$logDirectory, Debugger::$email, Debugger::getBlueScreen()); $this->slackUrl = $slackUrl; $this->logUrl = $logUrl; }
public static function registerBluescreen() { Debugger::getBlueScreen()->addPanel(['Librette\\Solarium\\Diagnostics\\Panel', 'renderException']); }
/** * Registers generic exception renderer */ public static function registerBluescreen(Nette\DI\Container $dic) { Debugger::getBlueScreen()->addPanel(function ($e) use($dic) { return Panel::renderException($e, $dic); }); }
public static function registerBluescreen() { Debugger::getBlueScreen()->addPanel(array(get_called_class(), 'renderException')); }
public function search($params = []) { try { return parent::search($params); } catch (BadRequest400Exception $e) { Debugger::getBlueScreen()->addPanel(function () use($e) { $raw = Json::decode($e->getMessage()); $match = Strings::match($raw->error, '~Failed to parse source \\[(.*?)\\]+; nested: (.*?);~is'); $context = Json::decode($match[1]); $error = $match[2]; dump($error, $context); }); throw $e; } }
/** * Enable and set configuration to Tracy Handler * Event will Trigger this method on runtime when any exception * occurs */ public function handleException() { /* | Exception handler registered here. So it will handle all | exceptions and thrown as pretty format |----------------------------------- | Enable pretty exception handler and | do necessary configuration |----------------------------------- */ $config = Config::get('global.config'); $this->enable($config['logs']['activate'], $config['logs']['path'])->setTitle()->setDebugger(Debugger::getBlueScreen())->setEmailAddress($config['logs']['email'], $config['logs']['error.emailing'])->run(); }
public function register(Dibi\Connection $connection) { Tracy\Debugger::getBar()->addPanel($this); Tracy\Debugger::getBlueScreen()->addPanel([__CLASS__, 'renderException']); $connection->onEvent[] = [$this, 'logEvent']; }
/** * @return BlueScreen */ private static function getDebuggerBlueScreen() { if (method_exists('Tracy\\Debugger', 'getBlueScreen')) { return Debugger::getBlueScreen(); } else { $reflector = new \ReflectionClass(get_class(new Debugger())); $prop = $reflector->getProperty('blueScreen'); return $prop->isPublic() ? Debugger::$blueScreen : FALSE; } }
/** * Enable and set configuration to Tracy Handler * Event will Trigger this method on runtime when any exception * occurs */ public function handleException() { $config = Config::get('global.config'); // Exception handler registered here. So it will handle all your exception // and throw you pretty format Handler::register(function ($exception) use($config) { /* |----------------------------------- | Enable pretty exception handler and | do necessary configuration |----------------------------------- */ $exception->enable($config)->setTitle()->setDebugger(Debugger::getBlueScreen())->setEmailAddress($config['params']['log_email'], $config['enable_error_emailing'])->run(); unset($config); }); }
/** * @return \Tracy\BlueScreen */ private static function getDebuggerBlueScreen() { return Debugger::getBlueScreen(); }
/** * @return BlueScreen */ private static function getDebuggerBlueScreen() { return method_exists('Tracy\\Debugger', 'getBlueScreen') ? Debugger::getBlueScreen() : Debugger::$blueScreen; }
public static function initialize() { \Tracy\Debugger::getBar()->getPanel("Tracy:info")->data["Obo"] = \obo\obo::_VERSION; \Tracy\Debugger::getBlueScreen()->info[] = "Obo " . \obo\obo::_VERSION; \Tracy\Debugger::getBlueScreen()->addPanel("obo\\ForeseenErrorPanel::addPanel"); }
/** * @return ConnectionPanel */ public static function register() { $panel = new static(); $bar = Debugger::getBar(); if ($bar) { $bar->addPanel($panel); } Debugger::getBlueScreen()->addPanel(array($panel, 'renderException')); return $panel; }
/** * @param Application $application * @param Exception $e */ public function doOnError(Application $application, Exception $e) { Debugger::getBlueScreen()->render($e); die; }
public function register(\DibiConnection $connection) { Tracy\Debugger::getBar()->addPanel($this); Tracy\Debugger::getBlueScreen()->addPanel(array(__CLASS__, 'renderException')); $connection->onEvent[] = array($this, 'logEvent'); }