本文整理汇总了PHP中Tracy\Debugger::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::isEnabled方法的具体用法?PHP Debugger::isEnabled怎么用?PHP Debugger::isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracy\Debugger
的用法示例。
在下文中一共展示了Debugger::isEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDefault
/**
* @param Exception
* @return void
* @throws Nette\Application\AbortException
*/
public function actionDefault($exception)
{
if ($exception instanceof Nette\Application\BadRequestException) {
$code = $exception->getCode();
// load template 403.latte or 404.latte or ... 4xx.latte
$this->setView(in_array($code, array(403, 404, 405, 410, 500)) ? $code : '4xx');
if (Debugger::isEnabled()) {
// log to access.log
Debugger::log("HTTP code {$code}: {$exception->getMessage()} in {$exception->getFile()}:{$exception->getLine()}", 'access');
}
} else {
$this->setView('500');
// load template 500.latte
if (Debugger::isEnabled()) {
Debugger::log($exception, Debugger::ERROR);
// and log exception
}
}
$this->template->exception = $exception;
if ($this->isAjax()) {
// AJAX request? Note this error in payload.
$this->payload->error = true;
$this->terminate();
}
}
示例2: createGuzzleClient
/**
* @param $tempDir
* @param array $guzzleConfig
* @return \GuzzleHttp\Client
* @throws \Matyx\Guzzlette\GuzzletteException
*/
public static function createGuzzleClient($tempDir, $guzzleConfig = [])
{
if (isset(static::$client)) {
return static::$client;
}
if (Tracy\Debugger::isEnabled()) {
$handler = NULL;
if (isset($guzzleConfig['handler'])) {
$handler = $guzzleConfig['handler'];
if (!$handler instanceof GuzzleHttp\HandlerStack) {
throw new GuzzletteException("Handler must be instance of " . GuzzleHttp\HandlerStack::class);
}
} else {
$handler = GuzzleHttp\HandlerStack::create();
}
$requestStack = new RequestStack();
Tracy\Debugger::getBar()->addPanel(new TracyPanel($tempDir, $requestStack));
$handler->push(function (callable $handler) use($requestStack) {
return function ($request, array $options) use($handler, $requestStack) {
Tracy\Debugger::timer();
$guzzletteRequest = new Request();
$guzzletteRequest->request = $request;
return $handler($request, $options)->then(function ($response) use($requestStack, $guzzletteRequest) {
$guzzletteRequest->time = Tracy\Debugger::timer();
$guzzletteRequest->response = $response;
$requestStack->addRequest($guzzletteRequest);
return $response;
});
};
});
$guzzleConfig['handler'] = $handler;
}
static::$client = new GuzzleHttp\Client($guzzleConfig);
return static::$client;
}
示例3: handleGetExceptionLogFile
public function handleGetExceptionLogFile()
{
if (Debugger::isEnabled() && Debugger::getBar()) {
$presenter = $this->getPresenter(true);
echo file_exists($filename = $presenter->getParameter('file')) ? file_get_contents($filename) : '"' . $this->getParameter('file') . '" not found.';
$presenter->terminate();
}
}
示例4: sendExceptionLogFile
/**
* @param Application $sender
* @param \Exception $e
*/
public static function sendExceptionLogFile(Nette\Application\Application $sender, \Exception $e)
{
/** @var $presenter Presenter */
if (Debugger::isEnabled() && Debugger::getBar() && ($presenter = $sender->getPresenter()) && preg_match('/exceptionLogFile/', $e->getMessage())) {
echo file_exists($filename = $presenter->getParameter('file')) ? $presenter->payload->dibiPanel = file_get_contents($filename) : '"' . $presenter->getParameter('file') . '" not found.';
//Debugger::$bar = false;
die;
}
}
示例5: start
/**
* Must be called to enable process monitoring
*
* @param string $msg
* @return void
*/
public static function start($msg = 'process monitor starts...')
{
if (!Debugger::isEnabled()) {
return;
}
self::$consoleMode = !(empty($_SERVER['HTTP_X_REQUESTED_WITH']) && preg_match('#^Content-Type: text/html#im', implode("\n", headers_list())));
if (self::$consoleMode) {
self::$lineEnding = "\n";
}
for ($i = 0; $i < ob_get_level(); $i++) {
ob_end_flush();
}
self::$enabled = true;
self::$startTime = microtime(true);
self::$time = self::$startTime;
self::addSummary($msg . ' (reportMode: ' . self::$reportModes[self::$reportMode] . ')');
}
示例6: onKernelException
public function onKernelException(GetResponseForExceptionEvent $event)
{
$exception = $event->getException();
if (Debugger::isEnabled() && !$this->isIgnoredException($exception)) {
if ($this->storeUsernameInServerVariable && $this->tokenStorage !== null) {
$this->storeUsernameInServerVariable();
}
if (Debugger::$productionMode === true) {
Debugger::log($exception, Debugger::ERROR);
} else {
if (Debugger::$productionMode === false) {
ob_start();
Debugger::exceptionHandler($exception, true);
$event->setResponse(new Response(ob_get_contents()));
ob_clean();
}
}
}
}
示例7: dirname
<?php
use Gantry\Framework\Gantry;
try {
// Get Gantry instance and return it.
$gantry = Gantry::instance();
// Initialize the template if not done already.
if (!isset($gantry['theme.name'])) {
$gantry['theme.path'] = dirname(__DIR__);
$gantry['theme.name'] = $theme;
}
// Only a single template can be loaded at any time.
if (!isset($gantry['theme'])) {
include_once __DIR__ . '/theme.php';
}
return $gantry;
} catch (Exception $e) {
// Oops, something went wrong!
if (class_exists('\\Tracy\\Debugger') && \Tracy\Debugger::isEnabled() && !\Tracy\Debugger::$productionMode) {
// We have Tracy enabled; will display and/or log error with it.
throw $e;
}
// In frontend we want to prevent template from loading.
die('Failed to load template: ' . $e->getMessage());
}
示例8: renderDefault
public function renderDefault()
{
$this->template->isManager = $this->getUser()->isInRole('beer_manager');
$this->template->userId = $this->getUser()->getId();
$this->template->development = Debugger::isEnabled();
}
示例9: log
public function log($msg)
{
if (Debugger::isEnabled()) {
Debugger::log($msg, self::$logPriority);
}
}
示例10: bindToBar
/**
* Binds panel to debug bar.
*/
public function bindToBar()
{
// No SQL capturing in CLI or when debugger is off or when in production mode
if (php_sapi_name() === 'cli' || !Debugger::isEnabled() || Debugger::$productionMode) {
return;
}
$this->entityManager->getConfiguration()->setSQLLogger($this);
$this->connection = $this->entityManager->getConnection();
Debugger::getBar()->addPanel($this);
}