nette / tracy

😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.
https://tracy.nette.org
Other
1.75k stars 218 forks source link

How can I manually call Debugger::getBar()->render() in v2.9? #523

Open adrianbj opened 2 years ago

adrianbj commented 2 years ago

Version: 2.9.0

Hi @dg - this isn't really a bug, but I have relied on:

if(ob_get_level() == 0) ob_start();
Debugger::getBar()->render();
Debugger::$showBar = false;

as per your recommendation here: https://github.com/nette/tracy/issues/214#issuecomment-269364481

Of course now render() requires the $defer argument.

Any thoughts on how I might be able to handle this need in 2.9?

Thanks.

adrianbj commented 2 years ago

Please note that the reason this has come up is because in some server situations, I need to force Tracy to use native PHP sessions: https://github.com/adrianbj/TracyDebugger/issues/66

If I can use the new file-based sessions then the entire workaround isn't needed anymore, which is awesome!

dg commented 2 years ago

Hi. If the problem is that it doesn't use the native session, that should be switched:

Tracy\Debugger::setSessionStorage(new Tracy\NativeSession);
Tracy\Debugger::enable();

Furthermore, I think this Debugger::getBar()->render() could be replaced by this:

Debugger::getStrategy()->renderBar();
adrianbj commented 2 years ago

Hi @dg - unfortunately that doesn't help. If you take a look at: https://github.com/adrianbj/TracyDebugger/issues/66 there seems to be a conflict with the new file sessions and @teppokoivula 's setup. So I set an option to use NativeSession, but that conflicts with ProcessWire's SessionHandlerDB (which we discussed here: https://github.com/nette/tracy/issues/214#issuecomment-269364481) and is the reason why I am using:

Debugger::getBar()->render();
Debugger::$showBar = false;

which works great in Tracy 2.8, 2.7, 2.5 etc, but it no longer works in 2.9 and unfortunately Debugger::getStrategy()->renderBar(); doesn't make the AJAX bar work the way the above fix did for the older versions.

Is there anything else I can provide to help explain my need, or debug? Thanks.

dg commented 2 years ago

Honestly, I'm pretty lost in this :) If you had a repo with a minimal example of the situation, it would help me a lot.

dg commented 2 years ago

@adrianbj Did you manage to resolve it somehow?

adrianbj commented 2 years ago

@dg - not yet. Sorry for the delay - I'll try to get you access to a setup to test sooner than later.