adrian

Tracy Debugger

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!

 

Share this post


Link to post
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

Share this post


Link to post
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. 

 

Share this post


Link to post
Share on other sites
1 minute ago, ryanC said:

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. 

What happens when you click the icon to maximize it :)

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
1 minute ago, ryanC said:

Here's everything in one window:

You still haven't clicked on the Network tab.

I still think you should try the 0777 because I think that's very likely the problem.

Share this post


Link to post
Share on other sites

Do I make that change to the "TracyDebugger.module" file on my desktop, or is this in the processwire api itself?

Share this post


Link to post
Share on other sites
Just now, ryanC said:

Do I make that change to the "TracyDebugger.module" file on my desktop, or is this in the processwire api itself?

Let's take this to PM to avoid spamming all the followers here :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

@adrian I'll see what I can do over the weekend to try and get things working for TOCs in the readme files. Release Notes displays any files that start with "readme" - so you can split different topics into different readme files if that helps.

  • Like 1

Share this post


Link to post
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 :)

Share this post


Link to post
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

Share this post


Link to post
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. :)

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks for the report @Macrura - I have a fix in place here and I'll commit later today or tomorrow - just in the middle of some much larger changes. 

  • Like 2

Share this post


Link to post
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 ;)

 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By thuijzer
      https://github.com/thuijzer/processwire-FieldtypeBusinessHours
      Fieldtype Business Hours
      ProcessWire Fieldtype for entering business hours (opening hours)
       
      Input format
      Leave a day empty when closed on that day
      Times are in 24 hour format.
      9:00-12:00 9:00-12:00, 13:00-17:30 16:00-2:00  
      Usage in templates
      Days are from 1 to 7 where 1 is Monday and 7 is Sunday (ISO-8601)
      echo $page->field_name->isNowOpen() ? 'Now open' : 'Now closed'; if($page->field_name[1] == null) { echo 'Closed on Monday'; } if($page->field_name[2]->inRange('11:00')) { echo 'Tuesday at 11:00 open'; } echo $page->field_name[1]; echo $page->field_name[1]->entries[0]->getFrom()->format('H:i');  
    • By Harmen
      Hello all,
      Was wondering if any of you tried to include the Exact PHP client by Picqer in Processwire (URL)? I am trying to at the moment but I am stuck at the Authorization process. Building it inside a module file to execute a certain function every 6 hours to update something on the website. For the authorization process the file has to execute the following piece of code:
      header('Location:'. $urlThatRedirectsMeToTheLoginOfExact); But each time I am trying  to do so, I get the following error: Cannot modify header information - headers already sent by (output started at /processwire/index.php:55). I am out of options so that's why I am trying to find someone who used this library and could get it to work or someone who knows how I can fix it.
      Tips are highly appreciated (if they work ;))
      Cheers, Harmen
    • By BitPoet
      So I stumbled over the request to allow limiting templates to be used only once under every parent page in this thread
      and found that this would actually come in handy (also in a site I've built).
      The code can be found on github and soon also in the module repo.
      After installation, you'll find a new checkbox "Only once per parent" in the family tab when editing a template.

    • By Robin S
      Password Generator
      Adds a password generator to InputfieldPassword.

       
      Usage
      Install the Password Generator module.
      Now any InputfieldPassword has a password generation feature. The settings for the generator are taken automatically from the settings* of the password field.
      *Settings not supported by the generator:
      Complexify: but generated passwords should still satisfy complexify settings in the recommended range. Banned words: but the generated passwords are random strings so actual words are unlikely to occur.  
      https://modules.processwire.com/modules/password-generator/
      https://github.com/Toutouwai/PasswordGenerator
    • By Robin S
      If you've ever needed to insert links to a large number of files within CKEditor you may have found that the standard PW link modal is a somewhat slow way to do it.
      This module provides a quicker way to insert links to files on the page being edited. You can insert a link to an individual file, or insert an unordered list of links to all files on the page with a single click.
      CKEditor Link Files
      Adds a menu to CKEditor to allow the quick insertion of links to files on the page being edited.

      Features
      Hover a menu item to see the "Description" of the corresponding file (if present). Click a menu item to insert a link to the corresponding file at the current cursor position. The filename is used as the link text. If you Alt-click a menu item the file description is used as the link text (with fallback to filename if no description entered). If text is currently selected in the editor then the selected text is used as the link text. Click "* Insert links to all files *" to insert an unordered list of links to all files on the page. Also works with the Alt-click option. Menu is built via AJAX so newly uploaded files are included in the menu without the page needing to be saved. However, descriptions are not available for newly uploaded files until the page is saved. Installation
      Install the CKEditor Link Files module.
      For any CKEditor field where you want the "Insert link to file" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "LinkFilesMenu" to the "CKEditor Toolbar" settings field.
       
      http://modules.processwire.com/modules/cke-link-files/
      https://github.com/Toutouwai/CkeLinkFiles