Exemplo n.º 1
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();
         }
     }
 }
Exemplo 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();
     }
 }
Exemplo n.º 3
0
/**
 * Dump rendered Html element or code and intended output generated by tidy and optional also Html element structure
 *
 * @param Html|string $htmlElement        Html element or string
 * @param bool        $onlyReturn         output in string and don't send it to output?
 * @param int         $maxDepth           for Debugger::Dump output - to see how is the Html element built
 * @param bool        $includePrettyPrint along javascript code for prettyPrint activation?
 * @return string     Html output
 */
function dumpHtml($htmlElement, $onlyReturn = false, $maxDepth = 0, $includePrettyPrint = false)
{
    $maxDepthBackup = Debugger::$maxDepth;
    $maxLenBackup = Debugger::$maxLen;
    $showLocationBackup = Debugger::$showLocation;
    Debugger::$maxDepth = $maxDepth;
    Debugger::$maxLen = 200000;
    Debugger::$showLocation = false;
    // convert to string only once - important for Scaffolding Renderer output
    $renderedElement = (string) $htmlElement;
    $output = '<div class="rendered-element">' . $renderedElement . '</div>';
    $output .= '<pre class="prettyprint linenums pre-scrollable">' . htmlspecialchars(tidyFormatString($renderedElement)) . '</pre>';
    if ($includePrettyPrint) {
        $output .= '<script>prettyPrint();</script>';
    }
    if ($maxDepth > 0 && $htmlElement instanceof \Latte\Runtime\Html) {
        Debugger::dump($renderedElement);
        Debugger::dump($htmlElement);
    }
    Debugger::$maxDepth = $maxDepthBackup;
    Debugger::$maxLen = $maxLenBackup;
    Debugger::$showLocation = $showLocationBackup;
    if (!$onlyReturn) {
        echo $output;
    }
    return $output;
}
 public function onInitDebug()
 {
     if (!$this->isDebugMode()) {
         return;
     }
     Debugger::$maxDepth++;
     Debugger::$maxLen = 10000.0;
 }
Exemplo n.º 5
0
/**
 * LeonardoCA\Tools\ProcessMonitor::saves time interval shortcut.
 *
 * @param string $msg  message
 * @param mixed  $data - var, object to be dumped
 * @return void
 */
function pme($msg, $data = null)
{
    $backupMaxLength = Debugger::$maxLen;
    Debugger::$maxLen = 500;
    $backupMode = ProcessMonitor::$reportMode;
    ProcessMonitor::$reportMode = ProcessMonitor::SHOW_DETAIL;
    ProcessMonitor::addSummary($msg, $data);
    ProcessMonitor::$reportMode = $backupMode;
    Debugger::$maxLen = $backupMaxLength;
}
Exemplo 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'];
 }
Exemplo n.º 7
0
 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);
         }
     }
 }
Exemplo n.º 8
0
 * Edde is self-hosted; it is proof-of-concept or it can be used as tutorial. Many experimental features
 * are implemented here.
 */
use Edde\Api\Application\IApplication;
use Edde\Ext\Neon\NeonFile;
use Edde\Runtime\Bootstrap\BootstrapManager;
use Edde\Runtime\Bootstrap\Event\ConfigurationEvent;
use Edde\Runtime\Bootstrap\Event\SetupEvent;
use Edde\Runtime\Bootstrap\Event\StartupEvent;
use Tracy\Debugger;
require_once __DIR__ . '/../lib/tracy.phar';
require_once __DIR__ . '/../../src/loader.php';
BootstrapManager::bootstrap(function (ConfigurationEvent $configurationEvent) {
    $configurationEvent->getConfiguration()->addResource(new NeonFile(__DIR__ . '/../config/config.neon'))->addResource(new NeonFile(__DIR__ . '/../config/config.local.neon'), false);
}, function (SetupEvent $setupEvent) {
    $configuration = $setupEvent->getConfiguration();
    if ($configuration->isDevelMode()) {
        Debugger::enable(Debugger::DEVELOPMENT, $configuration->getDir('log'));
        Debugger::$strictMode = true;
        Debugger::$maxDepth = 12;
        Debugger::$maxLen = 8196;
    }
}, function (StartupEvent $startupEvent) {
    /**
     * optional - create (by default Edde's implementation) IApplication and run it; it holds whole life-cycle
     */
    $startupEvent->getContext()->create(IApplication::class)->run();
});
/**
 * and thats all; look around, there is many things to explore :)
 */
Exemplo n.º 9
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");
 }
Exemplo n.º 10
0
<?php

namespace Oliva\Test;

define('ROOT', __DIR__);
define('SCENES', ROOT . '/Scenes');
require_once __DIR__ . '/../vendor/autoload.php';
require_once SCENES . '/Scene.php';
require_once './DataWrappers/DataWrapper.php';
require_once './DataWrappers/LogWrapper.php';
use Tracy\Debugger, Tester\Environment;
// tester
Environment::setup();
// debugging
Debugger::$strictMode = TRUE;
Debugger::enable();
Debugger::$maxDepth = 10;
Debugger::$maxLen = 500;
// dump shortcut
function dump($var, $return = FALSE)
{
    return Debugger::dump($var, $return);
}
Exemplo n.º 11
0
#!/usr/bin/php
<?php 
$container = (require __DIR__ . '/../app/bootstrap.php');
use Tracy\Debugger;
Debugger::$maxDepth = 15;
Debugger::$maxLen = 2000;
$container->application->run();