Replace Nette\Diagnostics by Tracy – Recherche

Notice: This thread is very old.
Milo
Nette Core | 1283
+
0
-

I tried to remove whole Nette\Diagnostics and replace it by Tracy. And update the Sandbox to use all Nette native panels and works with it. You can find thematic commits in the Nette FW and in the Sandbox.

It works together, but it is only a recherche. There are issues I met, not sure they are all:

  1. Nette\Diagnostics vs. Tracy API differences (e.g. ND\Helpers::editorLink() returns Utils\Html) I didn't try to find all API differences yet.
  2. CSS styles. Nette native panels uses #nette... html IDs and nette- classes. I didn't try to find if CSS differences exist yet. CSS is 100% compatible.
  3. Directories with Nette native panels are named Diagnostics. Maybe this can be renamed.
  4. I didn't solve a Nette FW cloning yet. I guess, in loader.php must be check that Tracy is loaded too.
  5. Documentation – there is a many terms like “Nette debugger”

One big question is about userland debugger tools. NetteLoader generates E_USER_WARNING when renamed class is used. This would be annoing in application because it takes some time then 3rd party panels updates. How to solve it.

  • make an exception for Nette\Diagnostics classes in NetteLoader and leave WARNGINGs for next major (minor?) version
  • leave some empty classes, e.g. `interface Nette\Diagnostics\IBarPanel extends Tracy\IBarPanel {} `…

Last edited by Milo (2014-03-02 21:09)

David Grudl
Nette Core | 8218
+
0
-

Great work!

I think leaving some “empty” classes is solution, because the current Tracy API contains some historical relics that I would like remove, and these classes would address the back compatibility.

Patrik Votoček
Member | 2221
+
0
-

Nice! I agree with David.

Milo
Nette Core | 1283
+
0
-

OK.

In that case following methods will return an object from Tracy namespace even called on class from Nette\Diagnostics namespace:

Debugger::getBluescreen()
Debugger::getBar()
Debugger::getLogger()
Debugger::getFireLogger()

It can fails on user-land typehints. Any nice idea how to solve it? :)

David Grudl
Nette Core | 8218
+
0
-

class_alias in Nette\Diangostics\Debugger::enable()?

Šaman
Member | 2658
+
0
-

Ee? What is Tracy, if not Nette\Diangostics? I missed something?

Milo
Nette Core | 1283
+
0
-

BC break note. Classes:

Bar
BlueScreen
DefaultBarPanel
FireLogger
Logger
OutputDebugger

extend Nette\Object now. It will not as Tracy classes descendants/aliases.

Milo
Nette Core | 1283
+
0
-

BC break notes:

CSS is 100% compatible (well Tracy is one commit forward). All #nette... IDs and nette-... classes can be renamed to #tracy... resp. tracy-.

JavaScript code is 100% compatible. The only difference is tracyQ vs. netteQ object name and referenced CSS identifiers. I don't know if it affects any user's extensions.

Milo
Nette Core | 1283
+
0
-

PHP API differences:

# does not exist in Nette\Diagnostics\Bar
Tracy\Bar::$info

# does not exist in Nette\Diagnostics\Bluescreen
Tracy\Bluescreen::$info

# Following still exist in Nette as @deprecated, not exist in Tracy
Nette\Diagnostics\Debugger::$consoleMode
Nette\Diagnostics\Debugger::$consoleColors
Nette\Diagnostics\Debugger::$logger
Nette\Diagnostics\Debugger::$fireLogger

# public & @deprecated in Nette, private in Tracy
Nette\Diagnostics\Debugger::$blueScreen
Nette\Diagnostics\Debugger::$bar

# Nette only, missing in Tracy
Nette\Diagnostics\Debugger::addPanel()

# Tracy only, missing in Nette
Tracy\Helpers::createHtml()
Tracy\Helpers::fixEncoding()

# returns Nette\Utils\Html but Tracy returns string
Nette\Diagnostics\Helpers::editorLink()

Behavioral differences:

# Highlights Neon and Templating sources on exception
Nette\Diagnostics\Debugger::getBlueScreen()

Nette\Diagnostic classes throws exceptions from Nette namespace
but Tracy only theirs corresponding PHP native parents.

Last edited by Milo (2014-03-02 21:50)

Filip Procházka
Moderator | 4668
+
0
-

Milo wrote:

Classes … extend Nette\Object now. It will not as Tracy classes descendants/aliases.

The good think is none is typehinting Nette\Object and if is than he has bigger problems than BC :)

PHP API differences:

You can fix properties compatibility using references.

Milo
Nette Core | 1283
+
0
-

Filip Procházka Yes, that's true. I did't solve some serious implementation yet, these are just notes.