Tracy can now be disabled while it's still running.

- This allows the user to parse both Tracy and the FuzeWorks Logger
This commit is contained in:
Abel Hoogeveen 2019-03-01 11:19:17 +01:00
parent 5a37bdce2a
commit bb6fa39d90
No known key found for this signature in database
GPG Key ID: 96C2234920BF4292

View File

@ -59,6 +59,13 @@ class TracyComponent implements iComponent
*/
protected static $enableTracy = true;
/**
* Set to true after tracy has been started
*
* @var bool $enabled
*/
protected static $enabled = false;
public function getName(): string
{
return 'TracyComponent';
@ -88,7 +95,13 @@ class TracyComponent implements iComponent
// Disable screenLog
Events::addListener(function($event){
$event->setCancelled(true);
if (self::$enableTracy)
{
$event->setCancelled(true);
Logger::log("Cancelled FuzeWorks\Logger output");
}
else
Logger::log("Tracy is running but configured to not intercept FuzeWorks output. Ignoring...");
}, 'screenLogEvent');
// Enable Tracy. Use DEVELOPMENT mode when logger is enabled
@ -103,6 +116,7 @@ class TracyComponent implements iComponent
// Enable bridges
GitTracyBridge::register();
LoggerTracyBridge::register();
self::$enabled = true;
}
/**
@ -178,6 +192,6 @@ class TracyComponent implements iComponent
*/
public static function isEnabled(): bool
{
return self::$enableTracy;
return self::$enabled;
}
}