本文整理汇总了PHP中Tracy\Debugger::enable方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::enable方法的具体用法?PHP Debugger::enable怎么用?PHP Debugger::enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracy\Debugger
的用法示例。
在下文中一共展示了Debugger::enable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($mode = self::PRODUCTION)
{
// Start the timer and enable debugger in production mode as we do not have system configuration yet.
// Debugger catches all errors and logs them, for example if the script doesn't have write permissions.
TracyDebugger::timer();
TracyDebugger::enable($mode, is_dir(LOG_DIR) ? LOG_DIR : null);
}
示例2: onBootstrap
/**
* {@inheritDoc}
*/
public function onBootstrap(EventInterface $event)
{
/**
* @var ModuleOptions $moduleOptions
*/
$moduleOptions = $event->getTarget()->getServiceManager()->get('LemoTracy\\Options\\ModuleOptions');
if (true === $moduleOptions->getEnabled()) {
if (null !== $moduleOptions->getMode()) {
Debugger::enable($moduleOptions->getMode());
}
if (null !== $moduleOptions->getLogDirectory()) {
Debugger::$logDirectory = $moduleOptions->getLogDirectory();
}
if (null !== $moduleOptions->getLogSeverity()) {
Debugger::$logSeverity = $moduleOptions->getLogSeverity();
}
if (null !== $moduleOptions->getMaxDepth()) {
Debugger::$maxDepth = $moduleOptions->getMaxDepth();
}
if (null !== $moduleOptions->getMaxLen()) {
Debugger::$maxLen = $moduleOptions->getMaxLen();
}
if (null !== $moduleOptions->getShowBar()) {
Debugger::$showBar = $moduleOptions->getShowBar();
}
if (null !== $moduleOptions->getStrict()) {
Debugger::$strictMode = $moduleOptions->getStrict();
}
}
}
示例3: __construct
public function __construct($options = [], Application $app = null, RepositoryContract $config = null, Dispatcher $dispatcher = null)
{
static::$options = $config !== null ? array_merge($options, $config->get('tracy')) : $options;
TracyDebugger::$time = array_get($_SERVER, 'REQUEST_TIME_FLOAT', microtime(true));
TracyDebugger::$maxDepth = array_get(static::$options, 'maxDepth');
TracyDebugger::$maxLen = array_get(static::$options, 'maxLen');
TracyDebugger::$showLocation = array_get(static::$options, 'showLocation');
TracyDebugger::$strictMode = array_get(static::$options, 'strictMode');
TracyDebugger::$editor = array_get(static::$options, 'editor');
$bar = TracyDebugger::getBar();
foreach (array_get(static::$options, 'panels') as $key => $enabled) {
if ($enabled === true) {
$class = '\\' . __NAMESPACE__ . '\\Panels\\' . ucfirst($key) . 'Panel';
if (class_exists($class) === false) {
$class = $key;
}
$this->panels[$key] = new $class($app, static::$options);
$bar->addPanel($this->panels[$key], $class);
}
}
if ($dispatcher !== null) {
$dispatcher->listen('kernel.handled', function ($request, $response) {
return static::appendDebugbar($request, $response);
});
} else {
TracyDebugger::enable();
}
}
示例4: onAfterDebug
public function onAfterDebug(Container $c)
{
$p = $c->parameters;
if (isset($p['forceDebug'])) {
$mode = $p['forceDebug'] === FALSE ? Debugger::PRODUCTION : Debugger::DEVELOPMENT;
Debugger::enable($mode, LOG_DIR, 'bugs+mangopress@mangoweb.cz');
}
}
示例5: enableDebuggerWith
/**
* @param $enableMode
* @return $this
*/
private function enableDebuggerWith($enableMode)
{
if ($this->isLoggerEnabled() == true) {
Debugger::enable($enableMode, $this->getLogPath());
} else {
Debugger::enable($enableMode);
}
return $this;
}
示例6: enable
/**
* Enables displaying or logging errors and exceptions.
* @param mixed production, development mode, autodetection or IP address(es) whitelist.
* @param string error log directory; enables logging in production mode, FALSE means that logging is disabled
* @param string administrator email; enables email sending in production mode
* @return void
*/
public static function enable($mode = NULL, $logDirectory = NULL, $email = NULL)
{
parent::enable($mode, $logDirectory, $email);
self::$blueScreen = self::getBlueScreen();
self::$bar = self::getBar();
self::$logger = self::getLogger();
self::$fireLogger = self::getFireLogger();
self::$consoleColors =& Tracy\Dumper::$terminalColors;
}
示例7: enable
/**
* Enables displaying or logging errors and exceptions.
* @param mixed production, development mode, autodetection or IP address(es) whitelist.
* @param string error log directory; enables logging in production mode, FALSE means that logging is disabled
* @param string administrator email; enables email sending in production mode
* @return void
*/
public static function enable($mode = NULL, $logDirectory = NULL, $email = NULL)
{
trigger_error(__CLASS__ . ' is deprecated, use Tracy\\Debugger.', E_USER_DEPRECATED);
parent::enable($mode, $logDirectory, $email);
self::$blueScreen = self::getBlueScreen();
self::$bar = self::getBar();
self::$logger = self::getLogger();
self::$fireLogger = self::getFireLogger();
self::$consoleColors =& Tracy\Dumper::$terminalColors;
}
示例8: enableDebuggerWith
/**
* @param $enableMode
* @param array $config
*/
private function enableDebuggerWith($enableMode, $config = array())
{
$this->enableLogging = $config['enable_logging'];
if ($config['enable_logging'] == true) {
$logPath = str_replace('.', '/', $config['log_path']) . '/';
Debugger::enable($enableMode, $logPath);
} else {
Debugger::enable($enableMode);
}
}
示例9: __construct
public function __construct(array $allowedIpAddresses = array(), array $allowedMethods = array(), array $allowedUserAgents = array(), $logDirectory = NULL)
{
$httpRequestFactory = new Http\RequestFactory();
$this->allowedIpAddresses = $allowedIpAddresses;
$this->allowedMethods = $allowedMethods;
$this->allowedUserAgents = $allowedUserAgents;
$this->httpRequest = $httpRequestFactory->createHttpRequest();
if (!Debugger::isEnabled() && $logDirectory) {
Debugger::enable(Debugger::DETECT, $logDirectory);
Debugger::$logSeverity = E_NOTICE | E_WARNING;
}
}
示例10: onBootstrap
/**
* Setup Tracy\Debugger with options
*
* @param MvcEvent $e
* @return void
*/
public function onBootstrap(MvcEvent $e)
{
$app = $e->getApplication();
$config = $app->getConfig();
if (empty($config['tracy_debug']) || empty($config['tracy_debug']['enabled'])) {
return;
}
array_key_exists('mode', $config['tracy_debug']) or $config['tracy_debug']['mode'] = NULL;
array_key_exists('log', $config['tracy_debug']) or $config['tracy_debug']['log'] = NULL;
array_key_exists('email', $config['tracy_debug']) or $config['tracy_debug']['email'] = NULL;
Debugger::enable($config['tracy_debug']['mode'], $config['tracy_debug']['log'], $config['tracy_debug']['email']);
!array_key_exists('strict', $config['tracy_debug']) or Debugger::$strictMode = $config['tracy_debug']['strict'];
!array_key_exists('max_depth', $config['tracy_debug']) or Debugger::$maxDepth = $config['tracy_debug']['max_depth'];
!array_key_exists('max_len', $config['tracy_debug']) or Debugger::$maxLen = $config['tracy_debug']['max_len'];
}
示例11: instance
/**
* instance.
*
* @method instance
*
* @param array$config
*
* @return static
*/
public static function instance($config = [])
{
static $instance;
if (is_null($instance) === false) {
return $instance;
}
$config = array_merge(['enabled' => true, 'showBar' => true, 'editor' => 'subl://open?url=file://%file&line=%line', 'maxDepth' => 4, 'maxLength' => 1000, 'scream' => true, 'showLocation' => true, 'strictMode' => true, 'panels' => ['routing' => false, 'database' => true, 'view' => false, 'event' => false, 'session' => true, 'request' => true, 'auth' => false, 'terminal' => false]], $config);
$config['enabled'] = Arr::get($config, 'enabled', false);
$config['showBar'] = Arr::get($config, 'showBar', false);
$mode = isset($config['enabled']) === false ? Debugger::DETECT : $config['enabled'] === true ? Debugger::DEVELOPMENT : Debugger::PRODUCTION;
Debugger::enable($mode);
$debugbar = new Debugbar($config);
$debugbar->setup();
return $instance = $debugbar;
}
示例12: renderDefault
public function renderDefault()
{
\Tracy\Debugger::enable(\Tracy\Debugger::PRODUCTION);
$session = $this->getSession('cms');
$this->context->getService('menuModel')->setSiteId($session->siteId);
$this->context->getService('configurationModel')->setLanguageId($session->languageId);
$post = $this->request->post;
try {
$this->template->response = $this->{$post['action']}(json_decode($post['data']));
} catch (Exception $ex) {
if ($ex instanceof CmsException) {
$this->template->response = array('errorCode' => 2, 'error' => $ex->getMessage());
} else {
$this->template->response = array('errorCode' => 1, 'error' => $ex->getMessage() . 'on line ' . $ex->getLine() . ' at ' . $ex->getFile() . "\n\n" . $ex->getTraceAsString());
\Tracy\Debugger::log($ex);
}
}
}
示例13: register
/**
* @param Container $app
*
* @return mixed
*
* @throws DependencyInstanceNotFound
*/
public function register(Container $app)
{
/** @var Application $app */
$config = $this->config;
// this service provider will quietly fail if Tracy is not installed.
if (class_exists('\\Tracy\\Debugger') and $config->get('logging.tracy.enabled')) {
// use the environment to configure the Debugger
$env = env('APP_ENV') === 'PRODUCTION' ? Debugger::PRODUCTION : Debugger::DEVELOPMENT;
Debugger::$maxDepth = $config->get('logging.tracy.maxDepth', 6);
Debugger::enable($env, rtrim($config->get('logging.logPath', LOGS), '/'));
Debugger::$showLocation = env('DEBUG') and $config->get('logging.tracy.showLocation', FALSE);
Debugger::$strictMode = $config->get('logging.tracy.strictMode', FALSE);
Debugger::$showBar = FALSE;
# env('DEBUG');
// use the Tracy Debugger for logging.
$app['tracy'] = Debugger::getLogger();
$app['nine.logger'] = function ($app) {
return $app['tracy'];
};
}
}
示例14: header
<?php
use Nette\Caching\Storages\FileStorage;
use Nette\Loaders\RobotLoader;
use Tracy\Debugger;
use VersionPress\DI\DIContainer;
use VersionPress\DI\VersionPressServices;
define('VERSIONPRESS_PLUGIN_DIR', __DIR__);
define('VERSIONPRESS_MIRRORING_DIR', WP_CONTENT_DIR . '/vpdb');
define('VERSIONPRESS_TEMP_DIR', VERSIONPRESS_PLUGIN_DIR . '/temp');
define('VERSIONPRESS_ACTIVATION_FILE', VERSIONPRESS_MIRRORING_DIR . '/.active');
require_once VERSIONPRESS_PLUGIN_DIR . '/versionpress-functions.php';
if (defined('DOING_AJAX')) {
header("Content-Type: application/json");
}
Debugger::enable(Debugger::DEVELOPMENT, VERSIONPRESS_PLUGIN_DIR . '/log');
$robotLoader = new RobotLoader();
$robotLoader->addDirectory(VERSIONPRESS_PLUGIN_DIR . '/src');
$robotLoader->setCacheStorage(new FileStorage(VERSIONPRESS_PLUGIN_DIR . '/temp'));
$robotLoader->register();
global $versionPressContainer;
$versionPressContainer = DIContainer::getConfiguredInstance();
示例15: elapsed_time_since_request
<?php
/**
* @package Og
* @version 0.1.0
* @author Greg Truesdell <odd.greg@gmail.com>
*/
use Og\Forge;
use Og\Support\Util;
use Tracy\Debugger;
use Tracy\FireLogger;
Debugger::$maxDepth = 6;
Debugger::enable(Debugger::DEVELOPMENT, LOCAL_LOGS);
Debugger::$showLocation = TRUE;
$logger = Debugger::getLogger();
Forge::getInstance()->instance(['logger', FireLogger::class], $logger);
/**
* @param bool $raw
*
* @return string
*/
function elapsed_time_since_request($raw = FALSE)
{
return !$raw ? sprintf("%8.1f ms", (microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000) : (microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000;
}
/**
* @param $index
*
* @return string
*/
function location_from_backtrace($index = 2)