Tracy: the standalone version of Nette Debugger

4 years ago

David Grudl
founder | 6665
+
0
-

After five years of development, here is a really standalone version of tool you know very well as:

  • Laděnka
  • Nette Debug
  • Nette Debugger
  • Nette Diagnostics

And now it is called Tracy.

Currently, Tracy has the same API as Nette\Diagnostics (only namespace was changed). But I think this is chance to take a step in the development and find much better API. Any ideas?

4 years ago

echo
Member | 134
+
0
-

David Grudl wrote:

And now it is called Tracy.

Currently, Tracy has the same API as Nette\Diagnostics (only namespace was changed). But I think this is chance to take a step in the development and find much better API. Any ideas?

Wouldn't it be better then if Nette was using Tracy rather than Nette\Diagnostics as there would be no duplicities when updating either source (Nette master/Tracy master)? In my opinion both should be identical. Or not?

4 years ago

MartinitCZ
Member | 590
+
0
-

I think that echo has right.

This is not good idea. One app in two different namespaces.

4 years ago

Majkl578
Moderator | 1379
+
0
-

Nette itself should require/suggest Tracy in composer.json and remove Nette\Diagnostics.

4 years ago

Filip Procházka
Moderator | 4694
+
0
-

I agree, It can be added to dev and Nette could have BC aliases in itself.

4 years ago

MartinitCZ
Member | 590
+
0
-

@**Filip Procházka**: But I think that if replace Nette\Diagnostic with Tracy (over composer) will be in 2.1 … you can skip alliases

4 years ago

Filip Procházka
Moderator | 4694
+
0
-

Better BC = happier users.

4 years ago

MartinitCZ
Member | 590
+
0
-

@**Filip Procházka**: That sounds like a good idea ;)

4 years ago

Milo
Moderator | 1028
+
0
-

This is not an idea to API change, but idea for manual libs loading.

Tracy.php // loader + shortcuts
Tracy.no-shortcuts.php // loader

I have never met with naming conflict pesonally, I use only Tracy ;-), but it seems to me as a nice harmless way to disable shortcuts.

4 years ago

Milo
Moderator | 1028
+
0
-

And add one more shortcut:

function bdump($var)
{
    Tracy\Debugger::barDump(func_get_args());
}

4 years ago

David Grudl
founder | 6665
+
0
-

Tracy should be compatible with Composer autoloading, so there should be something like Tracy\Shortcuts::init().

4 years ago

Milo
Moderator | 1028
+
0
-

To the API change topic… I would appreciate these changes.

  1. Convert static classes to singletons. For Dumper and Debugger at least. In my code is often Debugger::log($e), in better cases $this->logger->log($e) where:
class ErrorLogger {
    public function log(...) {
        Tracy\Debugger::log(...);
    }
}
  1. Provide mechanism to object dumping. E.g. Dumper::forObject('Milo\Class', function($dumper) {...}).
  2. Provide mechanism to easiest Dumper or Debugger configuration. This is my often usage:
Tracy\Debugger::enable(...);
Tracy\Debugger::$strictMode = TRUE;
Tracy\Debugger::$maxDepth = 1e5;
// and configure Dumper::COLLAPSE_COUNT is very hard

// Fluent may be helpful
Tracy\Debugger::configure()->enable(TRUE)->email(...)->getDumper()->maxDepth(10);
  1. Somehow remember which object/class members should stay collapsed or expanded. Or mark them as non-dumpable. It is very useful for big structures where is a little bit annoying still clicking after every dump. I have no concrete idea how to do it. Perhaps over JavaScript and cookie
this.collapsed['Milo\Class::member'] = TRUE;
  1. Provide interface to logging on non-stdout. Useful during XML-RPC debugging where FireBug does not exists. I have a SqliteDebugger where I fill dumps and by AJAX dumping them into browser. Somehow easy redirect whole BlueScreen/dumps html would be great.
  2. Possibility to continue after Warning/Notice in strictMode, just like PHP itself.

These are things which I find useful to have. I'm sure that some of issues can be solved in other way I proposed, it is just idea.

4 years ago

enumag
Member | 2126
+
0
-

Somehow remember which object/class members should stay collapsed or expanded. Or mark them as non-dumpable. It is very useful for big structures where is a little bit annoying still clicking after every dump. I have no concrete idea how to do it. Perhaps over JavaScript and cookie

Marking as non-dumpable would be good. I often get very large dumps because some large structures are dumped on multiple levels of the backtrace. The bluescreen rendering then takes VERY long time and the structures that caused it were pretty much useless for finding the error. I'd be glad to get rid of them.

Board footer

Hostováno na e-infrastruktuře CESNET. Děkujeme za podporu sdružení CESNET, z.s.p.o.