Jump to content

Tracy Debugger


adrian

Recommended Posts

On 3/25/2019 at 3:21 PM, adrian said:

Or you can force development mode for superusers. 

I guess Devilbox is preventing DETECT mode from determining whether you're on localhost or not. 

Will do, noted and yes could be Devilbox is doing that, thx for your help.

Edited by happywire
typo
  • Like 1
Link to comment
Share on other sites

16 hours ago, tthom_pw said:

 

Btw, if I delete all problematic files, with the next update, aren't those going back?

If I leave things as is, then yes. But if server scanners are going to regularly flag this file, then I'll move the Terminal to its own separate module so it's not part of Tracy.

Link to comment
Share on other sites

  • 2 weeks later...

@adrian sorry for the late answer, kids had ice hockey championship, dance show, I had a lot of work, etc... you know how it's going..

That hosting provider set an exception for shell.php, so, there it's OK, the site has saved.

But, today sent me an another hosting provider an email: your site was hacked! And they put shell.php into quarantine. At least, they didn't turn off the site completely. ?

So, +1 vote from me for separating Terminal function. Thanks!

 

Link to comment
Share on other sites

@tthom_pw - thanks for the updates. Looks like this is going to be an ongoing problem, so I have separated it out into its own module: http://modules.processwire.com/modules/process-terminal/

It can be run standalone, or via the Terminal panel in Tracy.

Hopefully this will help to make it available if you run your own server / VPS, but not cause problems for those Tracy users on shared hosting.

  • Like 5
Link to comment
Share on other sites

validator.nu (utilized by Tracy) seems to have been down for more than 16 hours or so. Most "is it down or just me" websites also report that it is down, a few report it is not down.
Does anyone have more info on this? I could not google any news regarding this issue.

  • Like 1
Link to comment
Share on other sites

On 4/29/2019 at 2:48 PM, szabesz said:

validator.nu

Is it just me who is upset by not being able to validate "real-time"? Anyway, in Tracy's source code I read:

"what about switching to: https://checker.html5.org ?"
So I just manually changed it to $this->validatorUrl = 'https://checker.html5.org/';
Seems to work.

@adrian Any chance of adding options to the Settings so that we can provide a working ULR without changing the source code? I am thinking of a text inputbox, so that any working service can be provided, just in case.

As far as I can see, currently we have three options: https://validator.github.io/validator/ of which html5.validator.nu/validator.nu does not work at the moment.

  • Like 1
Link to comment
Share on other sites

4 minutes ago, szabesz said:

@adrian Any chance of adding options to the Settings so that we can provide a working ULR without changing the source code? I am thinking of a text inputbox, so that any working service can be provided, just in case.

Sounds like an easy and valuable PR ?

  • Like 1
Link to comment
Share on other sites

18 minutes ago, bernhard said:

Sounds like an easy and valuable PR ?

I would probably need to spend 2 or 3 days on it. I guess it is not comparable to the time-frame Adrian needs to do it.

  • Like 1
Link to comment
Share on other sites

36 minutes ago, szabesz said:

I would probably need to spend 2 or 3 days on it. I guess it is not comparable to the time-frame Adrian needs to do it.

For sure Adrian will be faster than anybody else, but just see how he does those things with eg the vscode file editor links setting and do the same. This will never take you 2-3 days, I'm sure. And I guess you'll learn something new (otherwise you would not think that such a modification would take so long).

But I don't mean that as an offense. I just think that everybody of us (me included) should try to contribute as much as possible and not just request things ? 

  • Like 1
Link to comment
Share on other sites

Thanks @szabesz and @bernhard - I decided to just switch the service to https://checker.html5.org/ - I don't think an option to specify any service will be very useful because I parse the returned response before displaying it in the panel, so the service must return the expected html. 

Anyway, hopefully this will keep us going for a while - let me know if you notice any problems with this option.

  • Like 1
Link to comment
Share on other sites

7 hours ago, adrian said:

I don't think an option to specify any service will be very useful because I parse the returned response before displaying it in the panel, so the service must return the expected html.

I see.

Thanks for updating the module!

Link to comment
Share on other sites

7 hours ago, adrian said:

I parse the returned response before displaying it in the panel

BTW, I was not suggesting doing it in the panel, but in the module's settings. Isn't that possible either? Am I misunderstanding something?

Link to comment
Share on other sites

6 hours ago, szabesz said:

BTW, I was not suggesting doing it in the panel, but in the module's settings. Isn't that possible either? Am I misunderstanding something?

With the way the panel sends the HTML and parses the returned result, it needs to use a https://validator.github.io/validator/ based service. There are a few, but you can't use all validators that are online, because they aren't all based on nu validator.

Link to comment
Share on other sites

2 minutes ago, szabesz said:

What I meant was that we could be allowed to pick one of those listed here: https://validator.github.io/validator/ and not any other out there.

Yeah, but html5.validator.nu is down and validator.w3.org/nu doesn't work with the panel for some reason, so there is really only the checker.html5.org option anyways ?

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...

Hey @adrian! Sorry if this has been discussed/answered already – tried to browse a bit but there's just so much information here. Anyway, as I've been trying to integrate Tracy into my regular process, I've ran into a bit of a dilemma regarding the "output mode" setting.

The thing is that I'm used to displaying errors on screen when ProcessWire's debug mode is enabled, but Tracy seems to override that. The solution to this would apparently be the "output mode" setting, but since in my case the development often happens on a publicly viewable (development) domain, the "DETECT" setting doesn't work for me (as it assumes that my site is in PRODUCTION mode), and I already have programmatic rules in place for enabling $config->debug depending on the state of the site / environment. I would've assumed the debug mode to force Tracy to dev mode as well, but it seems that it doesn't.

I guess I'm mainly asking if this would make sense, or if there's a reason to keep Tracy's output mode and $config->debug separate? ?

Link to comment
Share on other sites

1 hour ago, teppo said:

Hey @adrian! Sorry if this has been discussed/answered already – tried to browse a bit but there's just so much information here. Anyway, as I've been trying to integrate Tracy into my regular process, I've ran into a bit of a dilemma regarding the "output mode" setting.

The thing is that I'm used to displaying errors on screen when ProcessWire's debug mode is enabled, but Tracy seems to override that. The solution to this would apparently be the "output mode" setting, but since in my case the development often happens on a publicly viewable (development) domain, the "DETECT" setting doesn't work for me (as it assumes that my site is in PRODUCTION mode), and I already have programmatic rules in place for enabling $config->debug depending on the state of the site / environment. I would've assumed the debug mode to force Tracy to dev mode as well, but it seems that it doesn't.

I guess I'm mainly asking if this would make sense, or if there's a reason to keep Tracy's output mode and $config->debug separate? ?

Maybe not the direct answer to your question, but You can easilly enable/disable Tracy in config dependant on your $config->debug setting.

  • Like 2
Link to comment
Share on other sites

2 hours ago, Ivan Gretsky said:

Maybe not the direct answer to your question, but You can easilly enable/disable Tracy in config dependant on your $config->debug setting.

Thanks Ivan! ?

So it would seem that I can at least solve this by setting that $config->tracyDisabled based on my own rules (or just use the same rules by stating that "$config->tracyDisabled = !$config->debug"), and then setting the output mode to DEVELOPMENT (or alternatively forcing development mode for superusers, since that's what I'm usually logged in while developing anyway).

Still would seem more "streamlined" if Tracy utilised ProcessWire's built-in debug mode flag, but again there may be a good reason why a more nuanced setup is required.

... although, now that I'm reading the docs more carefully, I'm also wondering if I should just stick with DEVELOPMENT mode all the time. I'm not entirely sure (yet) what's the harm in that, considering that only superusers and users with the tracy-debugger permission should see anything out of ordinary anyway – right? Or is this setting going to do/affect something else? Basically it seems that this setting is useful in case, say, a client is going through the site as a superuser and you don't want them to see the Tracy bar ?

--

Another thing I've been wondering – and this is completely unrelated to the questions above – is whether Tracy provides support for breakpoints, as in points of code where execution should stop and display current "state" in some manner?

I'm aware of the bd() function, but couldn't find anything pointing to this direction specifically. There is the bp() function, but apparently it's a different concept entirely – more like a timer than a breakpoint, really. Coming from Xdebug I'm used to relying on breakpoints while debugging features that I want to walk through step-by-step, stop before they are fully executed, etc. If the answer is "no", that's fine – I can always just use Xdebug on the side ?

Edit: should've kept digging further. Found this from the blog entry introducing Tracy Debugger:

Quote

While Tracy doesn't provide breakpoints/step through code functionality the way Xdebug does, it does provide a wide variety other features that I think make it a valuable tool, whether you use it in conjunction with Xdebug, or on its own.

I guess that answers my question above, and the suggested solution is indeed a combination of Tracy + Xdebug ?

Edited by teppo
  • Like 1
Link to comment
Share on other sites

Hey @teppo - you raise some interesting points regarding Tracy's output mode. Honestly I think when I initially set that logic up I wasn't certain of the approach that would make the most sense so what we currently have may not be perfect, but here are my thoughts on the current state of things.

In Production mode Tracy logs and emails (if set up) errors, but doesn't display the debug bar or errors on the screen. Unless you are a superuser or other authorized user, all sites will be in Production mode regardless of this setting. If you are a superuser and the output mode is set to Production or Detect (and the site is on a live server) and the "force" option is not checked, then Tracy will be in Production mode - I guess my thinking around this is that some superusers may not want Tracy to be in Development even for themselves when a site is live, but that on the dev version of their site with all the same settings, they would like it to be Development mode.

The reason it's not all tied to PW's debug mode is that if debug mode is on and for some reason Tracy doesn't capture the errors (unlikely/impossible I suppose), guest users may see PW/PHP error messages (not good!), so I like to have Tracy's Development mode tools (debug bar / bluescreen error stacks, etc) available for superusers even when debug mode is off on a live site.

I hope that explains a little of my thinking, but if you are struggling with the way things are set up and would like to see changes, I am definitely willing to consider your suggestions - I haven't revisited this logic in many years!

Re: breakpoints - sounds like you figured that all out in the end, but regarding the bp() method that is used by the Performance panel - that comes from the wording used in that Panel (https://github.com/Zarganwar/PerformancePanel/blob/master/src/Panel.php) which is clearly not a good use of the term and is confusing.

If you're interested, you may like to look through the other 3rd party panels available for the Tracy core: https://componette.com/search/tracy - in particular there are a couple of XDebug related panels that you might find helpful - they don't seem to be actively developed anymore, but perhaps you could investigate and we could implement one into TracyDebugger if helpful.

In general, I'd definitely appreciate any thoughts you have on Tracy and its functionality.

Cheers!

  • Like 3
Link to comment
Share on other sites

41 minutes ago, adrian said:

The reason it's not all tied to PW's debug mode is that if debug mode is on and for some reason Tracy doesn't capture the errors (unlikely/impossible I suppose), guest users may see PW/PHP error messages (not good!), so I like to have Tracy's Development mode tools (debug bar / bluescreen error stacks, etc) available for superusers even when debug mode is off on a live site.

I hope that explains a little of my thinking, but if you are struggling with the way things are set up and would like to see changes, I am definitely willing to consider your suggestions - I haven't revisited this logic in many years!

Thanks for the reply, @adrian. Your logic makes perfect sense to me!

I didn't think this through: I'm not used to debugging anything on production, so it didn't even occur to me that this way one can actually use Tracy on a real production / live site. I'll have to agree that enabling debug mode on production is a bad idea – partly because something may indeed slip through to the front end, and partly because some modules etc. may in fact behave differently (such as output some sort of debug log on screen) when the debug mode is enabled ?

I can definitely live with this, it's really not an issue. Mainly it was just a bit confusing while getting started with the module.

41 minutes ago, adrian said:

If you're interested, you may like to look through the other 3rd party panels available for the Tracy core: https://componette.com/search/tracy - in particular there are a couple of XDebug related panels that you might find helpful - they don't seem to be actively developed anymore, but perhaps you could investigate and we could implement one into TracyDebugger if helpful.

In general, I'd definitely appreciate any thoughts you have on Tracy and its functionality.

Awesome – definitely will check those out!

I've only been using Tracy "seriously" as of this morning, but I must say that I'm quite enjoying it already. It's a massive tool and so far I've only used a tiny fraction of its features, but I can see a lot of value in it ?

  • Like 1
Link to comment
Share on other sites

Just added a small feature that fixes a big pain point for me.

When editing a page, there is a new button in the AdminTools panel to change the "collapsed" status of all fields to fully open and editable.

image.png.5499dc7348ed10e620347ff1063d93b7.png

This is great for those fields that you don't want available regularly (especially for non-superusers), but occasionally need to view or edit.

Fields will remain like this until you click this alternate button, or the site cookies are cleared.

image.png.a748cefb87ae6a89e09c36278f9ab811.png

Hope you find it useful!

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