Jump to content

Tracy Debugger


adrian

Recommended Posts

Hi Adrian,

1-I just set PW’s debug mode in the config file…I think previously it was set to false, but tracy was working anyway. 

The other questions I am not sure how to go about solving. I think I will try to uninstall then reinstall Tracy first, if that does not work I will see if I can go over each bullet point. Thanks!

 

Link to comment
Share on other sites

3 minutes ago, ryanC said:

I think previously it was set to false, but tracy was working anyway

That setting doesn't affect Tracy's behavior, but if Tracy isn't working it will provide info that you wouldn't have otherwise.

Let me know how you go with reinstalling, or looking at those bullet points.

  • Like 1
Link to comment
Share on other sites

Hi, I just uninstalled/reinstalled, still just that little icon on the left hand side. 

-In my Chrome dev area I get network errors, but none appear to be about Tracy.
-I don’t know how to check if there are permission issues in the Tracy folder
-I went here to download Tracy…https://tracy.nette.org/
and it seems to have the same folders and files that processwire installed.

I think yesterday (when it was working) I minimized the panel by clicking the little arrow and I don't remember seeing it after that. 

 

Link to comment
Share on other sites

That's the thing, it's not behaving like a link. When I hover over it, I get a tooltip that says it's Tracy, but that's it. My cursor doesn't change like it would if I was hovering over a link, it's just like its inline text. 

So when I hit inspect element (over the icon) those are the errors in the screenshot from my first post.

Link to comment
Share on other sites

Just now, ryanC said:

That's the thing, it's not behaving like a link. When I hover over it, I get a tooltip that says it's Tracy, but that's it. My cursor doesn't change like it would if I was hovering over a link, it's just like its inline text. 

Ok, sorry, I jumped to a quick conclusion there :)

I think the key error in the console is the 403 - I think that is likely the file permission issue. If you go to the Network tab and reload the page, hopefully you can see the file that is not being loaded. This comes back to my file permission request. Can you temporarily set all files in /site/modules/TracyDebugger to 0777 so we can see if that is the issue. Obviously we'll sort out properly after that.

Link to comment
Share on other sites

Ok, @szabesz, @bernhard and anyone else who is interested :)

I have started populating the ReadMe with documentation (https://github.com/adrianbj/TracyDebugger).

I have made a start on the Table of Contents (TOC) and done a quick population of some content for Captain Hook and the Console. Basically just copied from the original Tracy blog post at the moment.

The TOC links work on Github, but unfortunately they don't work in @netcarver's Module Release Notes, but I doubt there is anything that can be done about that. CTRL/CMD+F always works fine though.

I might spend some more time today fleshing things out a little more, but I would really love some help populating these docs if anyone feels motivated - PR's gratefully accepted :)

 

  • Like 2
Link to comment
Share on other sites

2 minutes ago, netcarver said:

Remember, Release Notes displays any and all files that start with readme - so you can split different topics into different readme files if that helps.

I thought about that, but I think without a way to link from one file to another it would actually be a poorer experience in my use case, but I'll keep it in mind as the docs start to flesh out - they could end up quite large :)

Link to comment
Share on other sites

2 hours ago, adrian said:

I have started populating the ReadMe with documentation (https://github.com/adrianbj/TracyDebugger).

Minor change of plan. The ReadMe was going to be too long for the entry in the modules directory and also the TOC links didn't work there, so I have moved the docs into DOCUMENTATION.md and @netcarver has committed a change to ModuleReleaseNotes (which if you don't have, you should get) so that this DOCUMENTATION.md will now be displayed in the module settings, like this:

5a31c282d221b_ScreenShot2017-12-13at3_48_12PM.png.53750ae4740c6740ff845406c1a6b303.png

I think I am really happy with this approach!

Once the docs are more comprehensively populated, I will adjust the links from the Selector panel info icons to point to the appropriate panel info here, rather than the old blog post.

  • Like 4
Link to comment
Share on other sites

Hi @adrian,

I'm running 4.8.23 on localhost (pw 3.0.62) and I'm getting the following error when I enable the snippet runner:

UnexpectedValueException: RecursiveDirectoryIterator::__construct(/xxx/site/templates/TracyDebugger/snippets/): failed to open dir: No such file or directory in /xxx/site/modules/TracyDebugger/panels/SnippetRunnerPanel.php:254

Permissions are 777 on snippets folder.

Obviously I missed something, I just don't know what. :)

Link to comment
Share on other sites

1 minute ago, rick said:

Hi @adrian,

I'm running 4.8.23 on localhost (pw 3.0.62) and I'm getting the following error when I enable the snippet runner:

UnexpectedValueException: RecursiveDirectoryIterator::__construct(/xxx/site/templates/TracyDebugger/snippets/): failed to open dir: No such file or directory in /xxx/site/modules/TracyDebugger/panels/SnippetRunnerPanel.php:254

Permissions are 777 on snippets folder.

Obviously I missed something, I just don't know what. :)

Do you have the config setting for the snippet runner pointing to the correct folder - remember there are two options?

Link to comment
Share on other sites

2 minutes ago, adrian said:

Do you have the config setting for the snippet runner pointing to the correct folder - remember there are two options?

My bad. I had snippets under modules. Since I don't want extra stuff in my templates folder I set it to use assets. Works fine now. Sorry for the oversight on my part.

  • Like 1
Link to comment
Share on other sites

I've had this issue for a while but am just now getting around to posting about it – if i am seeing this correctly, minimizing the tracy bar is adding a 'hidden' class to the body, which makes any site using bootstrap turn completely white, since in bootstrap framework, there is this rule:

.hidden {
    display: none;
    visibility: hidden;
}

would be great if it didn't do that, since it scares some people when they minimize the toolbar and lose the site;

  • Like 1
Link to comment
Share on other sites

hi @adrian

today I revisited my old idea of a hook recorder ( see https://processwire.com/talk/topic/10857-making-hooks-visible-hookrecorder/ and this post by @Robin S https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&comment=137508 ). 

I tried another approach than Robin suggested and failed  (just found his post now by coincidence) :) Another possibility might be to modify the Filecompiler somehow so that it adds logging functions to every "public function ___" method.

I think hooks are still hard to grasp, especially for new users. See https://processwire.com/talk/topic/18037-2-date-fields-how-to-ensure-the-second-date-is-higher/?do=findComment&comment=158168 for example (that brought up my idea of the hookrecorder again). Robins solution does not sound too hard to implement. Maybe it's even easier now you integrated the ready/init/finished option for the console?

But even for advanced developers this feature could be very handy i think! Looking forward to hearing your thoughts and thanks for all the input for datatables ;)

 

Link to comment
Share on other sites

Hey @bernhard - I'd be happy to implement this in Tracy.

But first, I think I need to better understand exactly what you want to see in the output. Have you looked at the "Hooks Triggered" section of the Debug Mode panel?  That is called on each page request. What additional information would want to see. Sorry, I feel like I am not quite fully getting it yet.

Thanks!

  • Like 1
Link to comment
Share on other sites

19 hours ago, adrian said:

But first, I think I need to better understand exactly what you want to see in the output. Have you looked at the "Hooks Triggered" section of the Debug Mode panel?  That is called on each page request. What additional information would want to see. Sorry, I feel like I am not quite fully getting it yet.

Thanks adrian. I've never really used the debug tools as I didn't find them really helpful. Maybe I'm missing something and just don't know how to use them properly? But what I wanted to achieve with the hookrecorder was some kind of execution plan of all hookable methods. A list where you can see which method get's called after the other. Ideally it would also show some additional information (like which page was saved, wich arguments where provided...).

Maye it would also be possible to have some kind of nesting in it? The result could be something like this:

ProcessPageView::execute
ProcessPageView::ready
	ProcessPageEdit::buildForm (id=mypageid, ...)
		InputfieldWrapper::render (name=myfield, ...)
			Inputfield::render (name=myfield1, ...)
			Inputfield::render (name=myfield2, ...)
			Inputfield::render (name=myfield3, ...)
ProcessPageView::finished

I have no idea if that Execution Plan is correct... I'm quite familiar with hooking all around and looking for the right hook in the code but still I don't know exactly WHAT is going on WHEN. But looking on sime kind of list like above everybody would instantly get what is going on and would get a tremendously better understanding of how pw works. Then one could go further and look into the related class' code and inspect it.

This list could also show additional info, as I already mentioned. And what I mean is on the one hand information about some variables what is currently happening (like which field is going to be rendered etc.) and on the other hand maybe it could list all hooks that are currently applied to this method (similar to the hooks list of the debug tools, listing hooks by priority so that you instantly get an idea of what is going on).

I think such a tool would not only be of HUGE help for newbies but also for experienced devs. For example you could have a problem with some kind of pagesave actions... you have a hook that should change the page title to "myval" after every pagesave...

Pages::save (id=123)
	execute hook from file /site/ready.php on line 12: collapsed hook code
		[...] $page->title = 'myval'; [...]
Pages::saveReady (id=123)
	execute hook from file /site/modules/mymodule.module.php on line 240:
		[...] $page->title = 'my wrong value'; [...]
Pages::saved (id=123)
	no hooks executed

you would instantly see what's going on and that there is a conflicting saveReady hook overwriting the page title.

I hope you get my point now. Or maybe I should start using XDebug and that's exactly what it is doing? :) 

PS: The list of hooks we have in the debug tools seems to be a list of all active hooks? And the sorting order is not helpful for me - it is even confusing... Is there any system in the order they are presented?

  • Like 2
Link to comment
Share on other sites

1 hour ago, bernhard said:

But what I wanted to achieve with the hookrecorder was some kind of execution plan of all hookable methods.

So basically a stack trace of hooks and their parameters and results. Correct?  Personally, I think this would be great, especially for those of us who have not dove into the hook pool yet.

Link to comment
Share on other sites

  • adrian pinned and locked this topic
  • adrian unpinned and pinned this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...