mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Load debugger as early as possible
This commit is contained in:
parent
45e79f88a3
commit
c89f683b8c
|
|
@ -11,7 +11,6 @@ if (!is_file($autoload)) {
|
|||
}
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Debugger;
|
||||
|
||||
// Register the auto-loader.
|
||||
$loader = require_once $autoload;
|
||||
|
|
@ -27,7 +26,6 @@ $grav = Grav::instance(
|
|||
);
|
||||
|
||||
try {
|
||||
$grav['debugger'];
|
||||
$grav->process();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
|||
|
|
@ -16,13 +16,15 @@ class Debugger
|
|||
protected $debugbar;
|
||||
protected $renderer;
|
||||
|
||||
public function __construct() {
|
||||
$this->grav = Grav::instance();
|
||||
public function __construct()
|
||||
{
|
||||
$this->debugbar = new StandardDebugBar();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->grav = Grav::instance();
|
||||
|
||||
$config = $this->grav['config'];
|
||||
if ($config->get('system.debugger.enabled')) {
|
||||
$this->debugbar->addCollector(new \DebugBar\DataCollector\ConfigCollector((array)$config->get('system')));
|
||||
|
|
@ -76,7 +78,7 @@ class Debugger
|
|||
public function startTimer($name, $desription = null)
|
||||
{
|
||||
$config = $this->grav['config'];
|
||||
if ($config->get('system.debugger.enabled') || $name == 'config' || $name == 'debugger') {
|
||||
if ($name == 'config' || $name == 'debugger' || $config->get('system.debugger.enabled')) {
|
||||
$this->debugbar['time']->startMeasure($name, $desription);
|
||||
}
|
||||
return $this;
|
||||
|
|
@ -85,7 +87,7 @@ class Debugger
|
|||
public function stopTimer($name)
|
||||
{
|
||||
$config = $this->grav['config'];
|
||||
if ($config->get('system.debugger.enabled') || $name == 'config' || $name == 'debugger') {
|
||||
if ($name == 'config' || $name == 'debugger' || $config->get('system.debugger.enabled')) {
|
||||
$this->debugbar['time']->stopMeasure($name);
|
||||
}
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -53,9 +53,7 @@ class Grav extends Container
|
|||
|
||||
$container['grav'] = $container;
|
||||
|
||||
$container['debugger'] = function ($c) {
|
||||
return new Debugger($c);
|
||||
};
|
||||
$container['debugger'] = new Debugger();
|
||||
|
||||
$container['uri'] = function ($c) {
|
||||
return new Uri($c);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user