Jump to content

Tracy Debugger


adrian

Recommended Posts

20 hours ago, bernhard said:

I'm really thankful for what you built here as i learned a lot and i don't know where i would be today without all the help of tracy opening my eyes. maybe it's just me because tracy came in right in time and i've never used xdebug or the like - but i have the feeling i'm not the only one :)

Just wanted to say a special thanks for this comment - I am very glad to hear it's been so useful to you - several of you have also been instrumental in making Tracy as useful as it is, so thanks to you all as well!

  • Like 2
Link to comment
Share on other sites

Here is my post mentioning the idea of file-based settings. I think this could be useful for Tracy too. My current implementation in AOS is very basic, that could be improved with eg. saving settings file with domain suffix (settings-mydomain.com.php), etc.

 

  • Like 1
Link to comment
Share on other sites

6 minutes ago, tpr said:

I think this could be useful for Tracy too.

For ProcessWire too :) How about a core module that supports it? Or at least a 3rd party module that is a joined effort and can be used in such cases by module devs?

Edited by szabesz
extra o :P
Link to comment
Share on other sites

18 minutes ago, blynx said:

Hej,

is there another way (one-liner) to use TracyDebugger in modules instead of "use\Debugger" & "Debugger::barDump(...)"?
(working on a process module, namespace Processwire)

cheers,
Steffen

bd() and all the other shortcuts are available in the global namespace so you shouldn't need to do anything special.

Is that not working for you? Does it then actually work with use\Debugger" & "Debugger::barDump(...) ? If so, could you perhaps give me more info about where in the module you are trying to make the call? 

 

  • Like 2
Link to comment
Share on other sites

Glad it's working. Just a couple of FYIs for using Tracy with modules in case you missed them from above. If it's an autoload module, then sometimes Tracy isn't loaded before the module (nothing I can do about this until Ryan gets back to me). The other thing is that sometimes it pays to use the Dumps Recorder panel with "Preserve Dumps" checked as sometimes things can get lost during redirects within modules. This way, a simple reload will refresh the content of that panel and you'll have your dump.

  • Like 1
Link to comment
Share on other sites

I have just added a new config option for hiding the debug bar in modals. @tpr and I discussed this above and we decided to show in regular modals, but hide in inline ones, but the tripling up of the bar when editing a page in a modal and then editing an image from that page was driving me nuts, so now the default is to have it disabled in both modal types, but you can uncheck these if you want.

Screen Shot 2016-09-01 at 10.20.54 AM.png

 

  • Like 3
Link to comment
Share on other sites

Just wanted to let everyone here know that the Console panel just received a fix regarding UTF8 encoding:

The first time you load the console after the update you'll see your code as base64 encoded, but once you enter something new it will work fine after that.

Please let me know if you notice any other problems.

  • Like 1
Link to comment
Share on other sites

I see the problem... I installed the site with pwshell and didn't set a timezone.

In the response there was this warning

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

As soon as I set the timezone in the config.php everything started working.  Sorry for the alert

  • Like 1
Link to comment
Share on other sites

No problem - thanks for the explanation. Seems like one of those rare times I can see a valid use for the silence operator. I think I'll add it to all the strtotime calls in Tracy which should at least prevent the error for you.

  • Like 1
Link to comment
Share on other sites

I have spent some more time on the Module Disabler panel to make it easy to restore things if disabling a particular module breaks your site. Ryan has mentioned that there are some situations where this may happen and there is no way to avoid it, so I think this panel is now the safest way to disable modules for testing purposes.

Whenever you disable any modules, a backup of the "modules" database table is automatically saved. 

To restore you have two choices:

  • Copy "/site/assets/cache/TracyDebugger/restoremodules.php" to the root of your site and load it in your browser
    OR
  • Execute "/site/assets/cache/TracyDebugger/modulesBackup.sql" manually (via PHPMyAdmin, the command line, etc)

After you run the restoremodules.php file, it will automatically remove the backup file and itself from all locations.

Please let me know if you notice any problems or have suggestions for improving this.

  • Like 1
Link to comment
Share on other sites

A few more updates to the Module Disabler. 

The "restoremodules.php" script now works without bootstrapping PW, so it will work even if a disabled module has resulted in a fatal error.

Also added restore instructions to the panel.

Screen Shot 2016-09-03 at 7.48.46 PM.png

  • Like 1
Link to comment
Share on other sites

Well, not sure what's going on. Now it works fine, though I updated to 2.92 and then reverted to 2.87. Works fine here anyways :)

I got 'Error in DumpsRecorderPanel...' text in the panel itself. Maybe what I was about to dump was so dumb that it would need a DumbsRecorder instead :)

  • Like 1
Link to comment
Share on other sites

1 minute ago, tpr said:

I got 'Error in DumpsRecorderPanel...' text in the panel itself. Maybe what I was about to dump was so dumb that it would need a DumbsRecorder instead :)

Yeah - sounds like it must have been an error in the code you typed.

 

3 minutes ago, tpr said:

Well, not sure what's going on. Now it works fine, though I updated to 2.92 and then reverted to 2.87. Works fine here anyways

Just to clarify - you are back on 2.9.2 now and it's working fine in 2.9.2?

  • Like 1
Link to comment
Share on other sites

I know this is a little OT (ok, maybe a lot OT), but I just discovered the $sanitizer->testAll() option - maybe you guys all noticed it when it was introduced, but I missed it :)

Anyway, I think it is very handy and a great use of the console panel :)

Finding this I did notice that the list is not complete at the moment though (https://github.com/ryancramerdesign/ProcessWire/issues/2028)

Anyway, hope someone finds this useful like I did!

Screen Shot 2016-09-06 at 10.52.16 AM.png

  • Like 3
Link to comment
Share on other sites

cool, thank you :) that's one of the uncountable things i read in the blog and did not remember as it was not interesting enough to me at that time...

@console
i really love it. i use it not only for learning (try&error, checking things) processwire but also PHP in general (the usual stuff i can't remember by heart like strftime, substr and all that..) :-X

  • Like 2
Link to comment
Share on other sites

Hello Adrian,

Tracy makes problems during updates of modules if it is in strict mode (show warnings as errors), because there are several warnings of the PW core files. I use it in strict mode and I always have to disable Tracy Debugger if I want to update a module. Otherwise the module will not be updated if I skip the warning. So it would be a nice addition if you add an enable/disable link for Tracy Debugger at the bottom like AdminOnSteroids module (see image below). This makes the workflow much easier.

Screenshot_12.jpg

Best regards

  • Like 1
Link to comment
Share on other sites

13 minutes ago, Juergen said:

if you add an enable/disable link for Tracy Debugger at the bottom like AdminOnSteroids module (see image below)

As opposed to AOS, we can enable Tracy for both frontend and admin, so the disable feature would be nice to have on its main panel too, which I have already missed a few times.

  • Like 1
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...