Jump to content
adrian

Tracy Debugger

Recommended Posts

Hey Adrian,

--- SOLVED ---

I have this code that returns an unexpected result. I don't know if that's related to tracy, so I apologize if it is not...

I'm developing a module. $rc->step is a shopping cart step object and it is possible to attach forms to it. $step->forms is a WireArray. I add the form "test" to this WireArray but when I dump it, it shows just the name of the Form, whereas when I dump the single item via $step->forms->first() I get what I expect (an InputfieldForm object).

9weZNcW.png

On the "Full Object" tab the output is also as I'd expect it to be:

ejST8VO.png

I guess that's totally normal but I'd like to understand what's going on and why the form shows up as string in the Debug Info Tab, thx!

Edit: Ok sorry for this post, but it might also be interesting for somebody else. The debuginfo returns the id or classname of any WireData objects: https://github.com/processwire/processwire/blob/master/wire/core/WireArray.php#L2442-L2446

  • Like 2

Share this post


Link to post
Share on other sites

Hey @bernhard - glad you figured it out.

The one thing I would like to know more about is that errant padding at the bottom of the tab labels/links. Could you please figure out what css rule on your site is adding that padding so I can adjust Tracy's CSS so there is no conflict?

Thanks.

Share this post


Link to post
Share on other sites

@kongondo and everyone else 🙂

I have just added caching for both the Tracy and PW logs panels so now they only read a log file if it has changed since it was last cached. This should make a dramatic difference to most page loads.

Do note that if you have a large log file and a new entry is added, then the load time will still be slow for that first page load when the entry is logged, so you still may want to delete log files (or use the PW log prune function) if you notice a slow load.

Hope that helps everyone.

  • Like 6

Share this post


Link to post
Share on other sites

Just committed some improvements to the log panel caching and also added caching for the ToDo panel which is a HUGE improvement - this has gone from 1.5 seconds to 60ms in my tests.

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

Yes, I experience the same as @kongondo.

PW logs are running fast, but as soon as I enable Tracy Log, its getting slow. Here is a screenshot

image.png.2c1d924f95c5271ee1a15c04e6912ce6.png

And I think I know why it takes so long. Look at this. 1,48 GB WTF?

image.thumb.png.7aa40a03389e68dcf1614c879bf26779.png

Share this post


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

And I think I know why it takes so long. Look at this. 1,48 GB WTF?

Yeah, that'll do it 🙂

I am curious though - with the caching now in effect, doesn't it load quickly now? If not, then I expect there is an error that is being logged on every page load (meaning that the cache needs to be updated on each page load).

What errors are being logged?

Share this post


Link to post
Share on other sites

Thanks to ideas and feedback from @tpr, the File Editor panel now has a recently opened files selector which shows the last 10 files you opened - much quicker if you need to navigate back and forwards between several different files.

image.png.6cf84acf68baf77f3bbf3a4cc508eb50.png

 

There is also a new config setting which lets you exclude folders. Previously for performance it was best to limit the Base Directory setting to "Templates", rather than "Site" or "Root", but now you can select an higher level and exclude what you don't need. Most users will probably want to select "Site" and exclude "site/assets" and "site/modules" - this lets you access site/templates, as well as config.php, init.php. ready.php, & finished.php - you get the idea.

I also made some other speed improvements by excluding completely any directories with files that are not editable, so the payload for this panel is now much smaller.

Hope this helps you out when an online editor is the only option you have.

Don't forget the fullscreen toggle at the top left of the editor, or the normal "Maximize" toggle at the top right of the panel - makes life much nicer!

image.png.850ded00e50fed8b7d228ec4b13f4ae7.png

 

 

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

This is all @tpr's hard work - he has just added a search/filter implementation using his awesome filterbox.js - be sure to check it out and Star it!

Note that in addition to filtering, if you hit "Enter" it will load the first matched file.

Thanks again Roland - this is very cool!

C88CqYappr.gif.abd0deaaa94bcb80b37b4042a468fa5b.gif

  • Like 6

Share this post


Link to post
Share on other sites

Thanks @adrian, I was really missing these features (search and recents list). It was a challenge to set up FilterBox to fit in here but fortunately everything fell into place.

  • Like 3

Share this post


Link to post
Share on other sites

Hi Adrian,

Now that "live" is used as the default dump method there's an item in the shortcut methods description that should be deleted:

2019-03-18_114723.png.d4e6763a922165e38c2c6df2362b55b1.png

And maybe in the docs too? https://adrianbj.github.io/TracyDebugger/#/debug-methods?id=bardumplive
Or maybe move the explanation of live dumping to the intro of this section.

Also, I'm trying to get my head around how this live dump works. Are you able to point me to a page in the Nette docs that covers this feature? I've been looking but haven't been able to find it.

And if the dump data is loaded in realtime as the levels are expanded then how come there is truncation in the example shown below?

 2019-03-18_115743.png.875dba621efa7890920b4cd4b708abf0.png

Thanks.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for spotting the left over LIVE reference.

Actually between 2.6 dev and the releases version of 2.6 of the Tracy core, they actually changed LIVE to LAZY. LIVE still exists as a separate option but it still has some downsides. In most cases LAZY is better. You can read more about it here: https://github.com/nette/tracy/issues/344#issuecomment-468123490

Your data is still truncated because of the default maxDepth of 3 which is tweakable in the module settings. With lazy it's possible to have a much greater depth without performance issues so maybe I will up that at some point. You can of course still use db() or bdb() or bd($var, [10]) or one of the other combinations to up the depth. You'll find that with the new LAZY approach you can actually do a bd($page, [10]) and it won't cause an out of memory error like it would with Tracy 2.5. Hope that helps. If you have any more technical questions let me know, or perhaps address them to @dg at Nette.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the info. From the discussion you linked to it sounds like the LIVE/LAZY features are still a work-in-progress and subject to change. So will wait a while before I delve into it.

The thing that was confusing me was that the previous barDumpLive() didn't take any $options argument for maxDepth or maxLength which made me think there is no limit for these when a live dump is used. But no problem to keep using bdb() for larger dumps.

  • Like 2

Share this post


Link to post
Share on other sites

Perhaps I was too hasty in removing the live option, so maybe it will make a comeback now that LAZY is the default - just need some more testing to see if it actually helps with large dumps, and whether there are issues with the integrity of the data.

So far from what I can tell, LAZY does an awesome job even with: 

bd($page, array('maxDepth' => 99));

or the shortcut:

bd($page, [99]);

 

  • Like 2

Share this post


Link to post
Share on other sites

Hi everyone.

Lots of new stuff this morning.

1) Terminal panel (available in a panel and also as a dedicated Process module - similar to how the Adminer feature is set up)

NOTE: It does not support interactive commands like vi, nano, apt, etc. DO NOT attempt to use these as they may result in you needing to restart apache.

This is a bash terminal that lets you quickly execute commands on a server. In addition to normal commands like: ls, cd, cat, mkdir, rm, chmod, chown, etc, you can also do mysql command line calls which is very handy if you need to add a new user, create a mysqldump etc.

Note that for mysql commands you need to issue them individually - you can't simply start "mysql" and issue commands from there - each call needs to include your username and password and the command to be run, eg:

mysql -u root -p mypassword -e "CREATE DATABASE newtablename";

There is also an upload and download command, eg "upload test.txt" which will spawn a file selector dialog on your machine to upload that file to your server with the given name. It also has arrow up and down for command history as well as tab autocompletion of commands and file names.

VS3HkyE49n.thumb.gif.f1c9be0f29a626eef431a3c5c5225f24.gif


2) Lots of new filterbox implementations

@tpr has again put in lots of work to implement filterbox on the APIExplorer, Captain Hook, and PHPInfo panels - these will be super helpful to search through these complex panels.

I have also added a ALT+F shortcut to get your cursor into the Find input for all these panels.

KwpdpHeWLI.thumb.gif.472bea94a8b5ecc97fe53222f801f95b.gif


Let us know how these new features work out for you.

Cheers!

 

  • Like 11

Share this post


Link to post
Share on other sites

Nice! Is terminal supported on windows? Don't have time to play right now, I just tried dir 🙂

 

 

Screenshot 2019-03-18 21.04.05_cr.jpg

  • Like 1

Share this post


Link to post
Share on other sites
19 minutes ago, matjazp said:

Nice! Is terminal supported on windows? Don't have time to play right now, I just tried dir 🙂

I had @tpr take a quick look and it sounded like it worked, but I don't think he tested thoroughly. Maybe @bernhard would be willing to have a look as well.

I know it works well on Mac and Linux.

Share this post


Link to post
Share on other sites

o6HTusV.png

It seems to be working, but in panel mode it's not really usable... The problem also occurs on the ProcessModule's page when I have more content than available screen space. I tried it on linux and it seems to have similar effects (eg when hitting TAB to list available directories on cd foo/bar/...

But I'm not keen on this new feature. When I need a terminal, then well... I open one. Most of the time from within my IDE via ssh. I don't see a benefit of using it via tracy - but maybe that's because I don't really like working in the terminal in general 🙂 

And I'm a little worried about security aspects... even if I don't have any idea how all that new console feature works. Just saying that if I don't need this feature I'm not really happy to have it there. I uninstalled the process module, but still... the code is somewhere on the server. Maybe you can tell us a bit to make me feel more comfortable 🙂 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for testing @bernhard - I'll see if I can duplicate the issues you are seeing with layout - it seems fine here, but I'll test some more and see if I can try on a Windows machine.

I agree that I would mostly choose a real terminal over this, but if I don't know the credentials for the server (or I am away from my computer), this is a pretty good backup, which is the way I view this feature.

Regarding security - I thought through this already and here's my reasons why it's not an issue:

1) The file is not available outside the process module - PW's htaccess restrictions ensure that.

2) The process module requires superuser permission.

3) It's no more dangerous than the Console panel or Hanna code - both let you run shell_exec commands on the server anyway. This just provides a nicer interface and returns the output for you.

That said, if anyone can think of a security concern that I have overlooked, please let me know.

  • Like 1

Share this post


Link to post
Share on other sites

@tpr has yet again put in lots of time to improve the filtering for the APIExplorer and Captain Hook panels:

PDkwvpi1Hz.thumb.gif.373d9fef08cbc6601a5f7fb885e3c680.gif

  • Like 3

Share this post


Link to post
Share on other sites
6 hours ago, bernhard said:

The problem also occurs on the ProcessModule's page when I have more content than available screen space. I tried it on linux and it seems to have similar effects (eg when hitting TAB to list available directories on cd foo/bar/...

Can you explain this a little more please. I just tested on a Windows machine (although pointed to a linux server), but I can't see any issues. Could you maybe put together a screencast for me demonstrating the issue? Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

@adrian and @tpr Thanks for the filterbox, that was also on my todo list, but now you done it. Could you please also add it to the user switcher panel?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.56
      Composer: rockett/jumplinks
      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! :)
    • By BitPoet
      As threatened in Ryan's announcement for 3.0.139, I built a little module for sliding toggles as a replacement for checkboxes. Styling of the input is CSS3 only (with all the usual caveats about older browsers), no JS necessary, and may still be a bit "rough around the edges", so to speak, since I didn't have much time for testing on different devices or brushing things up enough so I'd feel comfortable pushing it to the module directory. But here's the link to the GitHub repo for now:
      InputfieldSlideToggle
      Fieldtype and Inputfield that implements smartphone-style toggles as replacement for checkbox inputs. The visualization is CSS-only, no additional JS necessary.
      Status
      Still very alpha, use with caution!
      Features / Field Settings
      Size
      You can render the toggles in four different sizes: small, medium, large and extra large.
      Off Color
      Currently, "unchecked" toggles can be displayed either in grey (default) or red.
      On Color
      "Checked" toggles can be rendered in one of these colors: blue (default), black, green, grey, orange or red.
      Screenshots

      Some examples with checkbox label


      View all Size and Color Combinations
      Small toggles Medium toggles Big toggles Extra big toggles  









    • By Orkun
      Hi Guys
      I needed to add extended functionalities for the InputfieldDatetime Module (module is from processwire version 2.7.3) because of a Request of Customer.
      So I duplicated the module and placed it under /site/modules/.
      I have added 3 new Settings to the InputfieldDatetime Module.
      1. Day Restriction - Restrict different days based on weekdays selection (e.g. saturday, sunday) - WORKING

       
      2. Time Slots - Define Time slots based on custom Integer Value (max is 60 for 1 hour) - WORKING

       
      3. Time Range Rules per Weekday - Define a minTime and MaxTime per Weekday (e.g. Opening Hours of a Restaurant) - NOT WORKING PROPERLY

       
      The Problem
      Time Slots and Day Restriction working fine so far. But the Time Range Rules per Weekday doesn't work right.
      What should happen is, that when you click on a date, it should update the minTime and maxTime of the Time Select.
      But the change on the select only happens if you select a date 2 times or when you select a date 1 time and then close the datepicker and reopen it again.
      The time select doesn't get change when you select a date 1 time and don't close the picker.
      Here is the whole extended InputfieldDatetime Module.
      The Files that I have changed:
      InputfieldDatetime.module InputfieldDatetime.js jquery-ui-timepicker-addon.js (https://trentrichardson.com/examples/timepicker/) - updated it to the newest version, because minTime and maxTime Option was only available in the new version  
      Thats the Part of the JS that is not working correctly:
      if(datetimerules && datetimerules.length){ options.onSelect = function(date, inst) { var day = $(this).datetimepicker("getDate").getDay(); day = day.toString(); var mintime = $(this).attr('data-weekday'+day+'-mintime'); var maxtime = $(this).attr('data-weekday'+day+'-maxtime'); console.log("weekday: "+day); console.log("minTime: "+mintime); console.log("maxTime: "+maxtime); var optionsAll = $(this).datetimepicker( "option", "all" ); optionsAll.minTime = mintime; optionsAll.maxTime = maxtime; $(this).datetimepicker('destroy'); $(this).datetimepicker(optionsAll); $(this).datetimepicker('refresh'); //$.datepicker._selectDate($(this).attr("id"),date); //$.datepicker._base_getDateDatepicker(); // var inst = $.datepicker._getInst($(this)); // $.datepicker._updateDatepicker(inst); /*$(this).datetimepicker('destroy'); InputfieldDatetimeDatepicker($(this), mintime, maxtime); $(this).datetimepicker('refresh'); */ // $(this).datetimepicker('option', {minTime: mintime, maxTime: maxtime}); } } Can you have a look and find out what the Problem is?
      InputfieldDatetime.zip
       
      Kind Regards
      Orkun
    • By teppo
      This module tracks changes, additions, removals etc. of public (as in "not under admin") pages of your site. Like it's name says, it doesn't attempt to be a version control system or anything like that - just a log of what's happened.
      At the moment it's still a work in progress and will most likely be a victim of many ruthless this-won't-work-let's-try-that-instead cycles, but I believe I've nailed basic functionality well enough to post it here.. so, once again, I'll be happy to hear any comments you folks can provide
      https://modules.processwire.com/modules/process-changelog/
      https://github.com/teppokoivula/ProcessChangelog
      How does it work?
      Exactly like it's (sort of) predecessor, Process Changelog actually consists of two modules: Process Changelog and Process Changelog Hooks. Hooks module exists only to serve main module by hooking into various functions within Pages class, collecting data of performed operations, refining it and keeping up a log of events in it's own custom database table (process_changelog.) Visible part is managed by Process Changelog, which provides users a (relatively) pretty view of the contents of said log table.
      How do you use it?
      When installed this module adds new page called Changelog under Admin > Setup which provides you with a table view of collected data and basic filtering tools See attached screenshots to get a general idea about what that page should look like after a while.
      For detailed installation instructions etc. see README.md.
       


    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




×
×
  • Create New...