adrian

Tracy Debugger

Recommended Posts

wow! thank you for all your work! loving the logo - just updated my signature O0 :lol:

  • Like 2

Share this post


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

loving the logo

The logo is so funny, I like it too. If Ryan does not mind that you use it this way, why change it?

  • Like 1

Share this post


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

and working 200% faster thanks to favicon-16x16.png

Love it :)

  • Like 1

Share this post


Link to post
Share on other sites

Stoked about the new documentation site! I love it even more with the text size zoomed to 125% ;)

In due course it would be great to add a section about barDumpLive() / bdl() - I've never been clear on when it's okay to use this and when it should be avoided due to the dumped variable getting mixed up. I use it from time to time and when there is a variable mix-up it's usually pretty obvious, in which case I switch to bd() with max depth and max length options included. Although I still worry there might be situations where the mix-up is more subtle and could lead to confusion.

Related to this: what do you think about adding a new shortcut method for "big" bardumps? This could have options in the module config for max depth and max length. Just so there's a quick way to do a bardump where you need greater nesting depth and string length than with the standard bd(). I have added a custom shortcut in my IDE for inserting a bd() with max depth and length options, but it would be cool to have something like a "bdb()" method in Tracy (until the barDumpLive thing is resolved anyway).

 

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, Robin S said:

I love it even more with the text size zoomed to 125%

Taken care of that here - will push with the next update.

 

1 hour ago, Robin S said:

In due course it would be great to add a section about barDumpLive() / bdl()

Agreed - it will be in there with details and warnings. I am sure if it will ever be 100% reliable because of the way it works, but from my experience it only ever seems to be an problem when used within hooks.

 

1 hour ago, Robin S said:

but it would be cool to have something like a "bdb()"

I see two possibilities here :

  • a bdb() with some config settings to determine what the depth and length will be - I think the defaults should probably be 6 and 999 - any thoughts?
  • or a simplified syntax for bd(), eg bd($page, [6, 999]) so you don't have to do bd($page, ['maxDepth' => 6, 'maxLength' => 999]) which is painful

The problem with a fixed dbd() is that in the case of PW objects, anything more than 6 can results in out of memory errors (at least with my dev machine setup), but working with smaller objects/arrays, I often want 6 or 7.

I have decided to go with this for now, which sets the maxDepth to 6. Obviously pre PHP 5.4 you will still need: array(6)

bd($page, [6]);

You still need to make the depth and length settings an array - this is because the second argument in the array can either be the "title" or the options array. It's get too confusing to take it any further away from that default.

You can also do:

bd($page, [6,999]);

or:

bd($page, 'Dump Title', [6,999]);

How does that look to you?

I'll post this to the closed beta version shortly.

  • Like 2

Share this post


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

You can also do:


bd($page, [6,999]);

or:


bd($page, 'Dump Title', [6,999]);

How does that look to you?

Good solution, thanks.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Robin S said:

what do you think about adding a new shortcut method for "big" bardumps?

great idea, thx! needed that several times and maxLength=>... was a pain

9 minutes ago, adrian said:

anything more than 6 can results in out of memory errors (at least with my dev machine setup), but working with smaller objects/arrays, I often want 6 or 7.

10 minutes ago, adrian said:

bd($page, 'Dump Title', [6,999]);

How does that look to you?

would it be hard to have the shortcut bdb() for bd($page, [6,999]) ?

i think it would totally be fine to have that shortcut with fixed values since we have the other option of defining it manually like you showed above. but i think in 99% of the cases the bdb() would work just well and it is less to write and a lot easier to remember :)

  • Like 2

Share this post


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

would it be hard to have the shortcut bdb() for bd($page, [6,999]) ?

Ok, I'm on it :)

  • Like 1

Share this post


Link to post
Share on other sites

It's been out for about 10 days now, but I never really announced the changes here - wanted to see if there were any issues before publicizing.

The new 4.9.x version is now available.

Here's a list of the main changes:

1) New File Editor Panel

  • Supports editing all files in your PW install (you can define the root as /, /site, or /site/templates
  • Can be used as the handler for opening editor links from the debug bar (errors, log files, Captain Hook, ToDo, Template editor, etc), rather than your code editor.
  • Can be enabled as the link handler for live sites only, or local as well if you prefer.
  • Has "Test" functionality for all files so if you make a change, it will only appear for you and not other users.
  • Makes a backup of the old version each time you save a change and provides a "Restore Backup" button to instantly revert.
  • Supports in-code search & replace with CMD+F
  • Syntax highlighting/linting for PHP, CSS, and JS
  • This replaces the Template Editor panel, so that one has been removed.
  • Handles fatal errors gracefully - this is the biggest feature in my opinion. The problem with most online file editors is that if you accidentally make a code change that results in a fatal error, it can be impossible to fix and resave because the system is not functional. This editor gets around this problem by using Tracy's custom error handling which allows debug bar panels to continue to work, so you can manually fix the problem, or click the "Restore Backup" button. Of course if you used the "Test" option, you don't even need to worry, because you are the only one to see the version with the error anyway.

image.thumb.png.050d883e2f50b8359e5a84e4524515c0.png

As a follow up to that last point. I have used the excellent ProcessFileEdit module for helping to debug some issues on other people's sites without needing FTP access, but a couple of times I have made a fatal error mistake and had to get them to restore the file, so this really is a huge feature for me!

 

2) Support for Process File Edit

If you prefer ProcessFileEdit to this new File Editor Panel, so you can use it for handling debug bar links. Note that this won't give you the "Test" and "Restore" options, or the fatal error protection, so it's not really recommended. I added support for it before building the File Editor panel so decided to leave in case others prefer it.

3) Revamped Console Panel 

  • The code and results sections are now a "split" screen so you can adjust the size of one relative to the other with the bar in the middle. Handy for working, but especially handy when you want to post a screenshot to the forums
  • "Large and "Small" versions of the panel - click the arrows at the top right of the panel - the large version can be very handy when you have lots of code or results to display
  • Supports in-code search & replace with CMD+F

image.thumb.png.5f60f96951818223b0ba520e27643b56.png


4) New maxDepth and maxLength shortcuts and new barDumpBig() method

You can now replace dump or barDump calls like:

bd($var, array('maxDepth' => 7, 'maxLength' => 500));

with:

bd($var, [7,500]);

You can also make use of the new:

bdb($var);

as a shortcut to:

bd($var, [6,999]);

 

5) New SQL Query column in the Selector Queries section of the Debug Mode panel

This is a great learning tool to see the selector queries that are run for a given page request, and what SQL query these selectors are translated into:

image.thumb.png.6fba1698525c64823aa14d5c95c60937.png

 

6) Removed old Legacy version of Tracy core

  • It was getting too painful to maintain support for this old version. This means that TD now requires PHP 5.4.4+

7) Namespacing and refactoring lots of Javascript code

  • No feature changes, but code is now easier to follow and is much less prone to any name conflicts with your site

8) Reduced loading of unnecessary code

  • Lots of refactoring here too - should see some performance gains

9) New default server type indicator in the debug bar 

  • Not a big deal, but if you want a server type indicator and don't want the full height/width bar, you can now have one in the debug bar - I think it's a handy visual clue when looking at /working on live vs dev/test versions of a site at the same time.

image.png.fee9a07fbf469adfa336dcc06fa9f47b.png

 

10) Lots and lots of bugs fixes, layout, and styling improvements

  • It's amazing what you find when you're buried in the code for a couple of weeks solid :)
     

11) The new docs site that I mentioned earlier is now fairly complete - I just need to work on the Tips & Tricks section

  • https://adrianbj.github.io/TracyDebugger
  • Feel free to make a PR for improvements to the docs - everything is under the /docs folder in the main Github repo. There are also "Edit on github" links on each page so you can use those as well.
  • Like 13

Share this post


Link to post
Share on other sites

Tracydebugger has come a long way. Thanks for developing it into the powerful tool it has become. 

  • Like 3

Share this post


Link to post
Share on other sites
8 hours ago, pwired said:

Thanks for developing it into the powerful tool it has become.

Just a quick fix: "...the most powerful tool on this planet..." ;) 

  • Like 3

Share this post


Link to post
Share on other sites

JSON API response testing in the Console panel

I know we all know about json_decode($var, true), but here's a useful tip when working with APIs that return JSON.

Note that I am using the new shortcut for specifying a depth of 7 so I get to the deeper levels of the JSON response.

 

image.png.308bf5e4ecff17b0028200ed3d360439.png

 

Obviously that's a LOT nicer than:

image.png.49d3b2d1fe32a5950e604a8f609d5b22.png

 

  • Like 6

Share this post


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

Obviously that's a LOT nicer than:

:D Cool, thanks!

  • Like 1

Share this post


Link to post
Share on other sites

thanks for that tip!

30 minutes ago, adrian said:

Obviously that's a LOT nicer than:

sorry, dont't get it ???

Share this post


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

thanks for that tip!

sorry, dont't get it ???

Sorry @bernhard - I replaced the first image after my initial post, and accidentally replaced the second one as well. Take a look now :)

  • Haha 1

Share this post


Link to post
Share on other sites

New version just committed that is a must for Windows users - a huge thanks to @matjazp for the report and also local access to his dev machine so I could find and fix all the issues. You Windows guys need to speak up when you see issues ;) - the Console, Snippet Runner, and Captain Hook panels in particular were a mess :) Please let me know if you see anything I have missed.

Other changes include:

  • Add custom register_shutdown_function() for Console and Snippet Runner panels - especially important for PHP 5.x. PHP 7 handles most errors as non-fatal.
  • Fix AJAX panel updating for Console/Snippet Runner when SessionHandlerDB not installed.
  • A few styling fixes.
  • Like 4

Share this post


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

the Console, Snippet Runner, and Captain Hook panels in particular were a mess

Nothing obviously wrong/messy with those panels for me with v4.9.9 on Windows 8.1. Maybe some other factor comes into it. Thanks for the update though!

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, Robin S said:

Nothing obviously wrong/messy with those panels for me with v4.9.9 on Windows 8.1

Interesting - the key thing was incorrect line numbers on errors when running code in Console/Snippet Runner. And with Captain Hook panel it was a lack of grouping of file under the Site Modules headings. Maybe PHP on different version of Windows IIS handle forward / back slashes differently. All the issues came down to using strpos() to see if the path to a file contained a certain subpath, eg /site/modules - the trouble being that on Windows, I had to look for \site\modules instead. I fixed things with a combination of DIRECTORY_SEPARATOR and in some cases converting the paths to all forward slashes before doing checks, displaying links etc.

Thanks for keeping an eye out for any persistent / new issues.

Share this post


Link to post
Share on other sites

Another useful update - the File Editor panel now remembers and reopens the folder tree to the currently open file and highlights that file. Should make navigation to related files much simpler after save when the page reloads.

  • Like 2

Share this post


Link to post
Share on other sites
10 hours ago, tpr said:

Shadow DOM sounds like the ideal treat for Tracy bar encapsulation headaches,  when it will widely supported:

https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM

When you say "encapsulation headaches" are you talking mostly about css inheritance?

Sorry, I haven't had a good read of that link yet :)

Share this post


Link to post
Share on other sites

Yes, having a separated DOM inside the main DOM, with its fully separated CSS.

  • Like 1

Share this post


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

Yes, having a separated DOM inside the main DOM, with its fully separated CSS.

Sounds awesome - thanks for the heads up. I wonder how hard it will be to implement and whether it really needs to be implemented in the Tracy core or not?

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 BitPoet
      MediaLibrary
      Update: MediaLibrary can now be found in the official module list.
      Out of necessity, I've started to implement a simple media library module.
      The basic mechanism is that it adds a MediaLibrary template with file and image fields. Pages of this type can be added anywhere in the page tree.
      The link and image pickers in CKEditor are extended to allow quick selection of library pages from dropdowns. In the link picker this happens in the MediaLibrary tab, where you can also see a preview of the selected image. In the image picker, simply select a library from the dropdown at the top, everything else is handled by standard functionality.
      I've put the code onto github. This module is compatible with ProcessWire 3.
      Steps to usage:
      Download the module's zip from github (switch to the pw3 branche beforehand if you want to test on PW 3.x) and unpack it into site/modules Click "Modules" -> "Refresh" in the admin Click "Install" for MediaLibrary For testing, create a page with the MediaLibrary template under home (give it an expressive title like 'Global Media') and add some images and files Edit a differnt page with a CKEditor field and add a link and an image to see the MediaLibrary features in action (see the screencap for details) Optionally, go into the module settings for MediaLibrary Note: this module is far from being as elaborate as Kongondo's Media Manager (and doesn't plan to be). If you need a feature-rich solution for integrated media management, give it a look.
      Feel free to change the settings for MediaFiles and MediaImages fields, just keep the type as multiple.
      There are some not-so-pretty hacks for creating and inserting the correct markup, which could probably be changed to use standard input fields, though I'm a bit at a loss right now how to get it to work. I've also still got to take a look at error handling before I can call it fit for production. All feedback and pointers are appreciated (that's also why I post this in the development section).

      Edit 09.03.2016 / version 0.0.4: there's now also a "Media" admin page with a shortcut to quickly add a new library.

      Edit 01.05.2016:
      Version 0.0.8:
      - The module now supports nested media libraries (all descendants of eligible media libraries are also selectable in link/image picker).
      - There's a MediaLibrary::getPageMediaLibraries method you can hook after to modify the array of available libraries.
      - You can switch between (default) select dropdowns or radio boxes in the module configuration of MediaLIbrary to choose libraries.
      Edit 10.10.2018:
      Version 0.1.3:
      - Dropped compatibility for ProcessWire legacy versions by adding namespaces
      - Allow deletion of libraries from the Media overview admin page
      - Added an option to hide media libraries from the page tree (optionally also for superusers)
    • By Robin S
      This module corrects a few things that I find awkward about the "Add New Template" workflow in the PW admin. I opened a wishlist topic a while back because it would good to resolve some of these things in the core, but this module is a stopgap for now.
      Originally I was going to share these as a few standalone hooks, but decided to bundle them together in a configurable module instead.
      Add Template Enhancements
      A module for ProcessWire CMS/CMF. Adds some efficiency enhancements when adding or cloning templates via admin.

      Features
      Derive label from name when new template added: if you like to give each of your templates a label then this feature can save some time. The label can be added automatically when templates are added in admin, in admin/API, or not at all. There are options for underscore/hyphen replacement and capitalisation of the label. Edit template after add: when adding only a single template, the template is automatically opened for editing after it is added. Copy field contexts when cloning: this copies the field contexts (a.k.a. overrides such as column width, label and description) from the source template to the new template when using the "Duplicate/clone this template?" feature on the Advanced tab. Copy field contexts when duplicating fields: this copies the field contexts if you select the "Duplicate fields used by another template" option when adding a new template. Usage
      Install the Add Template Enhancements module.
      Configure the module settings according to what suits you.
       
      https://github.com/Toutouwai/AddTemplateEnhancements
      https://modules.processwire.com/modules/add-template-enhancements/
    • By Mike Rockett
      As I mentioned in this issue, I've create a new textformatter for ParsedownExtraPlugin, which adds some oomph to your markdown.
      Repo: Parsedown Extra Plugin
      Unlike the built-in textformatter for Parsedown and Parsedown Extra, this should be used when you want to use Extra with additional configuration/customisation.
      Some examples:
      ### Test {.heading} - A [external link](https://google.com/){.google} with `google` as a class that opens in a new tab if the config property is set. - [Another link](/page){target=_blank} that opens in a new tab even though it isn't external. ```html .html <p>Test</p> ``` There's some config options available to you, such as setting attributes on all/external images and links, setting table and table-cell alignment classes, adjusting footnote classes and IDs, adding <code> attributes to their parent <pre> elements, and changing the <code> class if your syntax highlighter does not use language-*.
      I was thinking about adding the ability to make links open in a new tab by appending a plus to the link syntax, but only external links should be opening in a new tab anyway. Further, this would add extra, unnecessary processing time.
      Please let me know if you bump into any problems. ☺️
    • By Mike Rockett
      TextformatterTypographer (0.4.0 Beta)
      A ProcessWire wrapper for the awesome PHP Typography class, originally authored by KINGdesk LLC and enhanced by Peter Putzer in wp-Typography. Like Smartypants, it supercharges text fields with enhanced typography and typesetting, such as smart quotations, hyphenation in 59 languages, ellipses, copyright-, trade-, and service-marks, math symbols, and more.
      Learn more on my blog
      It's based on the PHP-Typography library found over at wp-Typography, which is more frequently updated and feature rich that its original by KINGdesk LLC.
      The module itself is fully configurable. I haven't done extensive testing, but there is nothing complex about this, and so I only envisage a typographical bug here and there, if any.
      Please do test it out and let me know what you think.
      Also note that I have indicated support for PW 2.8, but I haven't tested there as yet. This was built on PW 3.0.42/62.
    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.50
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy!