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.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By MarkE
      This fieldtype and inputfield bundle was built for storing measurement values within a field, rendering them in a variety of formats and converting them to other units or otherwise modifying them via the API.
      The API consists of a number of predefined functions, some of which include...
      render() for rendering the measurement object, valueAs() for converting the value to another unit value, convertTo() for converting the whole measurement object to different units, and add() and subtract() for for modifying the stored value by the value (converted as required) in another measurement. In the admin the inputfield includes a checkbox (which can be optionally disabled) for converting values on page save. For an example if a value was typed in as centimeters, the unit was changed to metres, and the page saved with this checkbox selected, said value would be automatically converted so that e.g. 170 cm becomes 1.7 m.

      A simple length field using Fieldtype Measurement and Inputfield Measurement.
      Combination units (e.g. feet and inches) are also supported.
      Please note that this module is 'proof of concept' at the moment - there are limited units available and quite a lot of code tidying to do. More units will be added shortly.
      See the GitHub at https://github.com/MetaTunes/FieldtypeMeasurement for full details and updates.
    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
    • By tcnet
      This module implements the website live chat service from tawk.to. Actually the module doesn't have to do much. It just need to inserted a few lines of JavaScript just before the closing body tag </body> on each side. However, the module offers additional options to display the widget only on certain pages.
      Create an account
      Visit https://www.tawk.to and create an account. It's free! At some point you will reach a page where you can copy the required JavaScript-code.

      Open the module settings and paste the JavaScript-code into the field as shown below. Click "Submit" and that's all.

      Open the module settings
      The settings for this module are located int the menu Modules=>Configure=>LiveChatTawkTo.

       
    • By tcnet
      Session Viewer is a module for ProcessWire to list session files and display session data. This module is helpful to display the session data of a specific session or to kick out a logged in user by simply delete his session file. After installation the module is available in the Setup menu.

      The following conditions must be met for the module to work properly:
      Session files
      Session data must be stored in session files, which is the default way in ProcessWire. Sessions stored in the database are not supported by this module. The path to the directory where the session files are stored must be declared in the ProcessWire configuration which is by default: site/assets/sessions.
      Serialize handler
      In order to transform session data easier back to a PHP array, the session data is stored serialized. PHP offers a way to declare a custom serialize handler. This module supports only the default serialize handlers: php, php_binary and php_serialize. WDDX was dropped in PHP 7.4.0 and is therefore not supported by this module as well as any other custom serialize handler. Which serialize handler is actually used you can find out in the module configuration which is available under Modules=>Configure=>SessionViewer.

      Session data
      The session data can be displayed in two different ways. PHP's default output for arrays print_r() or by default for this module nice_r() offered on github: https://github.com/uuf6429/nice_r. There is a setting in the module configuration if someone prefers print_r(). Apart from the better handling and overview of the folded session data the output of nice_r() looks indeed nicer.

      Links
      ProcessWire module directory
      github.com
    • By Robin S
      Repeater Easy Sort
      Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number of items.
      The module also enhances Repeater Matrix by allowing a colour to be set for each matrix type. This colour is used in the item headers and in the "add new" links, to help visually distinguish different matrix types in the inputfield.
      Screencasts
      A Repeater field

      A Repeater Matrix field with custom header colours

      Easy-sort mode
      Each Repeater/Matrix item gets an double-arrow icon in the item header. Click this icon to enter easy-sort mode.
      While in easy-sort mode:
      The items will reduce in width so that more items can be shown on the screen at once. The minimum width is configurable in the field settings. Any items that were in an open state are collapsed, but when you exit easy-sort mode the previously open items will be reopened. You can drag an item left/right/up/down to sort it within the items. The item that you clicked the icon for is shown with a black background. This makes it easier to find the item you want to move in easy-sort mode. You can click an item header to open the item. An "Exit easy-sort mode" button appears at the bottom of the inputfield. Configuration
      In the field settings for Repeater and Repeater Matrix fields you can define a minimum width in pixels for items in easy-sort mode. While in easy-sort mode the items will be sized to neatly fill the available width on any screen size but will never be narrower than the width you set here.
      In the field settings for Repeater Matrix you can define a custom header colour for each matrix type using an HTML "color" type input. The default colour for this type of input is black, so when black is selected in the input it means that no custom colour will be applied to the header.
      Exclusions
      The easy-sort mode is only possible on Repeater/Matrix fields that do not use the "item depth" option.
       
      https://github.com/Toutouwai/RepeaterEasySort
      https://processwire.com/modules/repeater-easy-sort/
×
×
  • Create New...