Add DEV/PROD parameter to debugger constructor

This commit is contained in:
Matias Griese
2014-08-18 14:45:42 +03:00
parent fcedae6085
commit 846c836cb8
2 changed files with 6 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ if (!ini_get('date.timezone')) {
$grav = Grav::instance(
[
'Loader' => $loader,
'Debugger' => new Debugger
'Debugger' => new Debugger(Debugger::PRODUCTION)
]
);

View File

@@ -9,12 +9,15 @@ use \Tracy\Debugger as TracyDebugger;
*/
class Debugger
{
public function __construct()
const PRODUCTION = TracyDebugger::PRODUCTION;
const DEVELOPMENT = TracyDebugger::DEVELOPMENT;
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(TracyDebugger::DEVELOPMENT, is_dir(LOG_DIR) ? LOG_DIR : null);
TracyDebugger::enable($mode, is_dir(LOG_DIR) ? LOG_DIR : null);
}
public function init()