zegenie/caspar — pull request #2 by lsproc (2012-04-11 21:28:08+00:00)
Title: Debugger

Implements a debugger mostly containing the features from the TBG one, but includes the following changes:

- Details on the B2DB setup
- Backtraces (including variables
- Improved AJAX support - every AJAX query is sent with a debugger entry in the JSON output, which can then be added to the debugger UI by the application's JS (this is the programmer's responsibility) - this only occurs in debug mode
- JSON support in the debugger - if the request is an AJAX request, then all the JSON values in the output are included in the debugger (except the debugger field) for inspection. Goodbye Firebug!
- Stored variables - to see what specific variables hold during execution, the value of the variable can be instantaneously stored in the debugger and is var_dump'ed so you can inspect it. Saves you adding var_dump and die calls to the execution
- A full-page UI to support all this

The debugger is entirely self contained, and only requires the user to add one function call to their script. The CSS is automatically added by Caspar, and the JS needed to support the debugger for the main page load is included with the debugger. It is, however, the programmer's responsibility to add the JS needed to add additional debugger rows for AJAX requests.

For this, it is simply necessary to append the value of the JSON value which (I think) is called csp_debugger to the debugger's content div: id numbers to apply to divs (allowing tab changes etc.) are timestamps so its not necessary to sequentially allocate ID numbers for rows.