Jump to content
adrian

Tracy Debugger

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? 

Share this post


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

Share this post


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

 

Share this post


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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@Robin S - on mobile so can't test but have you tried the Dumps Recorder panel? If that doesn't help I'll try to investigate later.

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, adrian said:

have you tried the Dumps Recorder panel?

I have now, and it works perfectly. Thanks! 🙂

  • Like 1

Share this post


Link to post
Share on other sites

Hi all,

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

Am I being silly and overlooking or misinterpreting something?

  • Like 1

Share this post


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

Share this post


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

I was expecting it to work for all templates.

Oh right - sorry, I forgot about that option 🙂 Let me take a look.

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Did you have to create those roles or does Tracy automatically generate them? I created the tracy-dev-all role as it didn't exist.

 

Screenshot 2019-12-19 at 01.11.58.jpg

Screenshot 2019-12-19 at 01.12.44.jpg

Screenshot 2019-12-19 at 01.13.06.jpg

Share this post


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

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 MoritzLost
      This is a new module that provides a simple solution to clearing all your cache layers at once, and an extensible interface to perform various cache-related actions.
      The simple motivation behind this module was that I was tired of manually clearing caches in several places after deploying a change on a live site. The basic purpose of this module is a simple Clear all caches link in the Setup menu which clears out all caches, no matter where they hide. You can customize what exactly the module does through it's configuration menu:
      Expire or delete all cache entries in the database, or selectively clear caches by namespace ($cache API) Clear the the template render cache. Clear out specific folders inside your site's cache directory (/site/assets/cache) Refresh version strings for static assets to bust client-side browser caches (this requires some setup, see the full documentation for details). This is the basic function of the module. However, you can also add different cache management action through the API and execute them through the module's interface. For this advanced usage, the module provides:
      An interface to see all available cache actions and execute them. A system log and logging output on the module page to see verify what the module is doing. A CacheControlTools class with utility functions to clear out different caches. An API to add cache actions, execute them programmatically and even modify the default action. Permission management, allowing you granular control over which user roles can execute which actions. The complete documentation can be found in the module's README.
      Beta release
      Note that I consider this a Beta release. Since the module is relatively aggressive in deleting some caches, I would advise you to install in on a test environment before using it on a live site.
      Let me know if you're getting any errors, have trouble using the module or if you have suggestions for improvement!
      In particular, can someone let me know if this module causes any problems with the ProCache module? I don't own or use it, so I can't check. As far as I can tell, ProCache uses a folder inside the cache directory to cache static pages, so my module should be able to clear the ProCache site cache as well, I'd appreciate it if someone can test that for me.
      Future plans
      If there is some interest in this, I plan to expand this to a more general cache management solution. I particular, I would like to add additional cache actions. Some ideas that came to mind:
      Warming up the template render cache for publicly accessible pages. Removing all active user sessions. Let me know if you have more suggestions!
      Links
      https://github.com/MoritzLost/ProcessCacheControl ProcessCacheControl in the Module directory

    • By joshua
      This module is (yet another) way for implementing a cookie management solution.
      Of course there are several other possibilities:
      - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/
      - https://github.com/webmanufaktur/CookieManagementBanner
      - https://github.com/johannesdachsel/cookiemonster
      - https://www.oiljs.org/
      - ... and so on ...
      In this module you can configure which kind of cookie categories you want to manage:

      You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience.
      Currently there are four possible cookie groups:
      - Necessary (always enabled)
      - Statistics
      - Marketing
      - External Media
      All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ...
      When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax:
      <script type="optin" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="optin" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The type has to be "optin" to get recognized by PrivacyWire, the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision.
      If you want to give the users the possibility to change their consent, you can use the following Textformatter:
      [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie.
      You can also add a custom link to output the banner again with a link / button with following class:
      <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> This module is still in development, but we already use it on several production websites.
      You find it here: https://github.com/blaueQuelle/privacywire/tree/master
      Download: https://github.com/blaueQuelle/privacywire/archive/master.zip
      I would love to hear your feedback 🙂
      Edit: Updated URLs to master tree of git repo
       
    • By David Karich
      Admin Page Tree Multiple Sorting
      ClassName: ProcessPageListMultipleSorting
      Extend the ordinary sort of children of a template in the admin page tree with multiple properties. For each template, you can define your own rule. Write each template (template-name) in a row, followed by a colon and then the additional field names for sorting.
      Example: All children of the template "blog" to be sorted in descending order according to the date of creation, then descending by modification date, and then by title. Type:
      blog: -created, -modified, title  Installation
      Copy the files for this module to /site/modules/ProcessPageListMultipleSorting/ In admin: Modules > Check for new modules. Install Module "Admin Page Tree Multible Sorting". Alternative in ProcessWire 2.4+
      Login to ProcessWire backend and go to Modules Click tab "New" and enter Module Class Name: "ProcessPageListMultipleSorting" Click "Download and Install"   Compatibility   I have currently tested the module only under PW 2.6+, but think that it works on older versions too. Maybe someone can give a feedback.     Download   PW-Repo: http://modules.processwire.com/modules/process-page-list-multiple-sorting/ GitHub: https://github.com/FlipZoomMedia/Processwire-ProcessPageListMultipleSorting     I hope someone can use the module. Have fun and best regards, David
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "https://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


×
×
  • Create New...