Jump to content

Tracy Debugger


adrian

Recommended Posts

On 10/12/2019 at 3:53 AM, bernhard said:

When I throw an exception the trace is shown, but that's the first call. It would be nice to analyze both.

I guess my suggestion above is not really much different to just throwing an exception so maybe that's not what you are looking for. Maybe I could capture the output via output buffering and push that into the dumps panel? Is that more what you are thinking? 

Link to comment
Share on other sites

On 10/12/2019 at 3:53 AM, bernhard said:

When I throw an exception the trace is shown, but that's the first call. It would be nice to analyze both.

By "analyze both", do you mean the stack trace and also some other bd() call? Not sure I quite follow.

Link to comment
Share on other sites

Hi Adrian, thx for your time ?

Simple example:

// ready.php
include('demo.php');

// demo.php
bd('fired');

OrkUkUb.png

12 hours ago, adrian said:

I guess my suggestion above is not really much different to just throwing an exception so maybe that's not what you are looking for. Maybe I could capture the output via output buffering and push that into the dumps panel? Is that more what you are thinking? 

Exactly ? 

Quote

Remember PW has a new bd(Debug::backtrace());  method you can use, but of course it returns an simply array, the same as PHP's debug_backtrace(), so I know it's not what you are looking for.

Thx, didn't know about that! That already helps. So for me it would already be great to get a trace() shortcut for that ? 

bjS8taP.png

And it would be awesome if the "file" entries in the trace would be clickable links that open that file in the IDE. But I don't want to steal your time, so if others don't find that useful I'd be happy with a simple trace() version ? Thx!

 

Link to comment
Share on other sites

12 hours ago, adrian said:

Maybe I could capture the output via output buffering and push that into the dumps panel? Is that more what you are thinking? 

If that's easier that would be even better because this screen shows all the used arguments as well. But it's really not that important ? 

Link to comment
Share on other sites

  • 2 weeks later...
On 10/27/2019 at 5:18 AM, spoetnik said:

Tracy Injects the 'Font Awesome 4.7.0' css into the frontend. This fucks up my layout, as I am using v 5.0.13 in my frontend. Is there an easy way to prevent tracy from injecting this css?

Simplest option for right now would be to remove all custom links from the PW Info panel - ie, empty the list on the right in the module settings.

image.thumb.png.247390dbe1e2000c1a4ad38df7bf6780.png

Link to comment
Share on other sites

Save Custom Snippets @file gives js error.

Pwire: v3.0.123, TracyDebugger: v4.19.35

I try to save my custom snippets as given in the options at a local snippet file instead of LocalStorage in the browser. I have set up path and file, but on initializing td console after page load I see this error @browser console:

Uncaught ReferenceError: getCustomCodeSnippets is not defined
    at <anonymous>:1:192812
    at HTMLScriptElement.script.onreadystatechange.script.onload [as onreadystatechange] (?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:1353)
(anonymous) @ VM2077:1
script.onreadystatechange.script.onload @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:1353
load (async)
load @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:1351
(anonymous) @ VM2077:1
script.onreadystatechange.script.onload @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:1353
load (async)
load @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:1351
(anonymous) @ VM2077:1
(anonymous) @ ace.js:1
(anonymous) @ ace.js:1
n @ ace.js:1
a @ ace.js:1
a @ ace.js:1
i.onload.i.onreadystatechange @ ace.js:1
load (async)
t.loadScript @ ace.js:1
t.loadModule @ ace.js:1
(anonymous) @ VM2077:1
script.onreadystatechange.script.onload @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:1353
load (async)
load @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:1351
(anonymous) @ VM2077:1
(anonymous) @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:531
evalScripts @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:525
init @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:37
(anonymous) @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:306
setTimeout (async)
(anonymous) @ ?login=1&_tracy_bar=js&v=2.6.3&XDEBUG_SESSION_STOP=1:301

Any idea what's wrong? Thanks for any hint!

Link to comment
Share on other sites

Maybe I get things wrong… I copied your js example-code now to my snippet file (and added the missed .js extension) – now there is no error anymore, but the snippets @file doesn't show up. I still see the snippets stored in local storage. The content (json) structure in local storage (code, modified, name) looks different from your example js code (name, content, tabTrigger)… I wonder if your code maybe is related to the snippet-runner panel? BTW. what means tabTrigger here?
Sorry for all my confusion and thank you for your instant reply Adrian. 

tracy-snippets-at-local-file.png

Link to comment
Share on other sites

Thanks @sz-ligatur for those screenshots - you are confusing two different features here. The use of "snippets" is probable confusing things here. The snippets that can be stored in that linked js file are autocompletion snippets triggered automatically when typing in the ACE code editor that the Console panel uses.

I think for your purposes you should be using the SnippetRunner panel (https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=snippet-runner) and storing each snippet and a separate *.php files under either:

  • /site/templates/TracyDebugger/snippets/
  • /site/assets/TracyDebugger/snippets/

Does that help explain things?

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Now that PHP 7.4 is stable, I have updated the Tracy core to the latest version and also made a few other fixes to the module for PHP 7.4. Please let me know if you notice any problems. Note that this issue in the PW core (https://github.com/processwire/processwire-issues/issues/1041) currently breaks the RequestInfo panel on 7.4.

  • Like 4
Link to comment
Share on other sites

  • 3 weeks later...

@adrian, I don't seem to be able to dump anything inside a LazyCron hook. I don't get any errors (like I would if Tracy wasn't available when the hook runs) - I just don't get any dump in the Tracy bar. Is that expected, and do you have any tips for viewing dumps made inside a LazyCron hook? Thanks.

Link to comment
Share on other sites

4 minutes ago, alexmercenary said:

Is anyone else noticing that using permission tracy-all-dev doesn't work? tracy-home-dev works fine however.

Do you have a template named "all" ? or are you expecting it to work for all templates?

Link to comment
Share on other sites

It looks like it's nested inside another if condition so doesn't ever get checked perhaps in TracyDebugger.module.php on line 1306?

EDIT: Ignore that. Misread. It's late here, sorry! Haha.

Edited by alexmercenary
My mistake
  • Like 1
Link to comment
Share on other sites

It all seems to be working fine here. 

I have these Tracy related permissions:

image.png.443e53d52fc7356fe9916affd0f4b0fc.png

I have applied the tracy-all-dev to the "editor" role and when I visit the home page with a user with the editor role, they see the home page with the home-dev.php template file:

image.png.8f0098a5cb9491e0c4e8546a7670b820.png

Link to comment
Share on other sites

Tracy doesn't create those automatically, so yes you do need to create manually.

Note that in your last screenshot you are showing the template, rather than the template filename. What does the filename row in the Template Info section show?

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...