当前位置: 首页>>代码示例>>PHP>>正文


PHP Debugger::isEnabled方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:kizi,项目名称:easyminer-easyminercenter,代码行数:30,代码来源:ErrorPresenter.php

示例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;
 }
开发者ID:matyx,项目名称:guzzlette,代码行数:41,代码来源:Guzzlette.php

示例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();
     }
 }
开发者ID:leonardoca,项目名称:tools,代码行数:8,代码来源:ComponentExceptionLogFile.php

示例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;
     }
 }
开发者ID:leonardoca,项目名称:tools,代码行数:13,代码来源:AjaxPanels.php

示例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] . ')');
 }
开发者ID:leonardoca,项目名称:tools,代码行数:23,代码来源:ProcessMonitor.php

示例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();
             }
         }
     }
 }
开发者ID:kutny,项目名称:tracy-bundle,代码行数:19,代码来源:KernelExceptionListener.php

示例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());
}
开发者ID:sam-suresh,项目名称:gantry5,代码行数:25,代码来源:gantry.php

示例8: renderDefault

 public function renderDefault()
 {
     $this->template->isManager = $this->getUser()->isInRole('beer_manager');
     $this->template->userId = $this->getUser()->getId();
     $this->template->development = Debugger::isEnabled();
 }
开发者ID:klajmajk,项目名称:futro,代码行数:6,代码来源:MainPresenter.php

示例9: log

 public function log($msg)
 {
     if (Debugger::isEnabled()) {
         Debugger::log($msg, self::$logPriority);
     }
 }
开发者ID:lexinek,项目名称:git-autodeploy-hook,代码行数:6,代码来源:Hook.php

示例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);
 }
开发者ID:dtforce,项目名称:nette-doctrine,代码行数:13,代码来源:DoctrineSQLPanel.php


注:本文中的Tracy\Debugger::isEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。