Esempio n. 1
0
 public function init()
 {
     $grav = Grav::instance();
     /** @var Config $config */
     $config = $grav['config'];
     $mode = $config->get('system.debugger.mode');
     TracyDebugger::$logDirectory = $config->get('system.debugger.log.enabled') ? LOG_DIR : null;
     TracyDebugger::$maxDepth = $config->get('system.debugger.max_depth');
     // Switch debugger into development mode if configured
     if ($config->get('system.debugger.enabled')) {
         if ($config->get('system.debugger.strict')) {
             TracyDebugger::$strictMode = true;
         }
         if (function_exists('ini_set')) {
             ini_set('display_errors', true);
         }
         if ($mode == strtolower('detect')) {
             TracyDebugger::$productionMode = self::DETECT;
         } elseif ($mode == strtolower('production')) {
             TracyDebugger::$productionMode = self::PRODUCTION;
         } else {
             TracyDebugger::$productionMode = self::DEVELOPMENT;
         }
     }
 }
Esempio n. 2
0
 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();
     }
 }
Esempio n. 3
0
 /**
  * {@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();
         }
     }
 }
Esempio n. 4
0
 /**
  * initializeTracyDebuger.
  *
  * @method initializeTracyDebuger
  *
  * @param array $config
  */
 protected function initializeTracyDebuger($config)
 {
     Debugger::$editor = Arr::get($config, 'editor', Debugger::$editor);
     Debugger::$maxDepth = Arr::get($config, 'maxDepth', Debugger::$maxDepth);
     Debugger::$maxLength = Arr::get($config, 'maxLength', Debugger::$maxLength);
     Debugger::$scream = Arr::get($config, 'scream', true);
     Debugger::$showLocation = Arr::get($config, 'showLocation', true);
     Debugger::$strictMode = Arr::get($config, 'strictMode', true);
     Debugger::$time = Arr::get($_SERVER, 'REQUEST_TIME_FLOAT', microtime(true));
     Debugger::$editorMapping = Arr::get($config, 'editorMapping', []);
 }
 /**
  * @return Configurator
  */
 protected function createConfigurator()
 {
     $this->defineConstants();
     $configurator = new Configurator();
     $configurator->setDebugMode($this->debugger);
     $configurator->enableDebugger(LOG_DIR);
     Debugger::$strictMode = FALSE;
     $configurator->setTempDirectory(TEMP_DIR);
     $configurator->createRobotLoader()->addDirectory(APP_DIR)->register();
     return $configurator;
 }
Esempio n. 6
0
 /**
  * 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'];
 }
 protected function registerDebugger()
 {
     $config = $this->app['config']['tracy'];
     Debugger::$time = array_get($_SERVER, 'REQUEST_TIME_FLOAT', microtime(true));
     Debugger::$maxDepth = array_get($config, 'maxDepth');
     Debugger::$maxLen = array_get($config, 'maxLen');
     Debugger::$showLocation = array_get($config, 'showLocation');
     Debugger::$strictMode = array_get($config, 'strictMode');
     Debugger::$editor = array_get($config, 'editor');
     $bar = Debugger::getBar();
     foreach ($config['panels'] as $key => $enabled) {
         if ($enabled === true or $enabled === '1') {
             $class = '\\' . __NAMESPACE__ . '\\Panels\\' . ucfirst($key) . 'Panel';
             $bar->addPanel(new $class($config, $this->app), $class);
         } elseif (is_string($enabled) === true) {
             $class = $enabled;
             $bar->addPanel(new $class($config, $this->app), $class);
         }
     }
 }
 /**
  * @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'];
         };
     }
 }
Esempio n. 9
0
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<h1>Tracy Warning and StrictMode demo</h1>

<?php 
require __DIR__ . '/../src/tracy.php';
use Tracy\Debugger;
Debugger::enable(Debugger::DETECT, __DIR__ . '/log');
Debugger::$strictMode = TRUE;
$f = fopen('nonexistent', 'r');
Esempio n. 10
0
 /**
  * @param  string        error log directory
  * @param  string        administrator email
  * @return void
  */
 public function enableDebugger($logDirectory = NULL, $email = NULL)
 {
     Tracy\Debugger::$strictMode = TRUE;
     Tracy\Debugger::enable(!$this->parameters['debugMode'], $logDirectory, $email);
 }
Esempio n. 11
0
 * Handle Cloudflare usage
 */
$_SERVER['REMOTE_ADDR'] = isset($_SERVER['HTTP_CF_CONNECTING_IP']) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $_SERVER['REMOTE_ADDR'];
require_once SRC_DIR . 'core/autoloader.php';
Twig_Autoloader::register();
/*
 * Set Debugger::DETECT to Debugger::DEVELOPMENT to force errors to be displayed.
 * This should NEVER be done on a live environment. In most cases Debugger is smart
 * enough to figure out if it is a local or development environment.
 */
if (Config::config('debugging') === true) {
    Debugger::enable(Debugger::DEVELOPMENT, SRC_DIR . '/logs');
} else {
    Debugger::enable(Debugger::DETECT, SRC_DIR . '/logs');
}
Debugger::$strictMode = true;
/*
* MySQL PDO Connection Engine
*/
ORM::configure(array('connection_string' => 'mysql:host=' . Config::config('mysql')->host . ';port=' . Config::config('mysql')->port . ';dbname=' . Config::config('mysql')->database, 'username' => Config::config('mysql')->username, 'password' => Config::config('mysql')->password, 'driver_options' => array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC), 'logging' => true, 'logger' => function ($query, $time) {
    DatabaseManager::logQuery($query, $time);
}, 'caching' => true, 'caching_auto_clear' => true));
/*
 * Initalize Global core
 */
$core = new stdClass();
$klein = new \Klein\Klein();
$core->auth = new Authentication();
$core->user = new User();
$core->server = new Server();
$core->email = new Email();
Esempio n. 12
0
 /**
  * @param  string        error log directory
  * @param  string        administrator email
  * @return void
  */
 public function enableDebugger($logDirectory = NULL, $email = NULL)
 {
     Tracy\Debugger::$strictMode = TRUE;
     Tracy\Debugger::enable(!$this->parameters['debugMode'], $logDirectory, $email);
     Nette\Bridges\Framework\TracyBridge::initialize();
 }
Esempio n. 13
0
 /**
  * Inicialização do Framework.
  * Método chamado para inicializar os atributos da classe Manager e registrar os AutoloadPaths.
  * @param string $configFile Arquivo de configuração do Maestro
  * @param string $basePath Diretório onde o Maestro está instalado
  * @param string $app Aplicação a ser executada.
  */
 public static function init()
 {
     $debug = self::getConf('maestro.debug.enabled');
     if ($debug) {
         $mode = self::getConf('maestro.options.mode') == 'DEV' ? Tracy\Debugger::DEVELOPMENT : Tracy\Debugger::PRODUCTION;
         Tracy\Debugger::enable($mode, self::$maestroPath . DIRECTORY_SEPARATOR . 'log');
         Tracy\Debugger::$logSeverity = self::getConf('maestro.debug.severity');
         Tracy\Debugger::$strictMode = self::getConf('maestro.debug.strictMode');
         Tracy\Debugger::$maxDepth = self::getConf('maestro.debug.maxDepth');
         // default: 3
         Tracy\Debugger::$maxLen = self::getConf('maestro.debug.maxLen');
         // default: 150
     }
     error_reporting(self::getConf('maestro.debug.severity'));
     // Maestro 1.0 compatibility
     // self::addAutoloadClass('mlogin', self::$classPath . '/Security/MLoginMaestro1.php');
     // Session
     self::$session = new MSession();
     self::$session->init($_REQUEST['sid'] === '0' ? 0 : mrequest('sid'));
     self::$baseURL = self::$request->getBaseURL(false);
     Manager::logMessage('[RESET_LOG_MESSAGES]');
     /*
             if (self::$java = ($_SERVER["SERVER_SOFTWARE"] == "JavaBridge")) {
        require_once (self::$home . "/java/Java.inc");
        self::$javaContext = java_context();
        self::$javaServletContext = java_context()->getServletContext();
             }
     * 
     */
     self::getLogin();
     self::$msg = new MMessages(self::getSession()->lang ?: self::getOptions('language'));
     self::$msg->loadMessages();
     self::$mode = self::getOptions("mode");
     date_default_timezone_set(self::getOptions("timezone"));
     setlocale(LC_ALL, self::getOptions("locale"));
     //self::$mad = self::getConf('maestro.mad.module');
     self::$app = self::getConf('maestro.app');
     register_shutdown_function("shutdown");
 }
Esempio n. 14
0
<?php

require __DIR__ . '/../vendor/autoload.php';
use Tracy\Debugger;
$configurator = new Nette\Configurator();
//$configurator->setDebugMode('23.75.345.200'); // enable for your remote IP
$configurator->enableDebugger(__DIR__ . '/../log');
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(__DIR__)->addDirectory(MODEL_DIR)->register();
//
// enable debugger
//
Debugger::enable(IS_PRODUCTION);
$configurator->setDebugMode(TRUE);
Debugger::$strictMode = FALSE;
$configurator->addParameters(array('generatedDir' => GENERATED_DIR));
$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/config.local.neon');
$container = $configurator->createContainer();
\App\BackendModule\Grids\Boolean::register();
return $container;
Esempio n. 15
0
 /**
  * Activation debugger tools and settings.
  * @param string directory for storing captured logs in a production environment.
  * @param string email administrator to send messages about a newly generated log.
  */
 public function enableDebugger($logDirectory = NULL, $email = NULL)
 {
     Debugger::$strictMode = TRUE;
     Debugger::enable($this->mode, $logDirectory, $email);
 }