To illustrate the use with some examples.
Ex 1. jdbg::p($var);
simply prints $var with the printer assigned in jdbg plugin configuration
Ex 2. jdbg::p($var, $varCond, "re:[a-z]+");
prints $var with the printer assigned in jdbg plugin configuration only if $varCond matches the given regular expression of [a-z]+
Ex 3. jdbg::p($var, $varCond, jdbg::IS_EMPTY);
prints $var with the printer assigned in jdbg plugin configuration only if $varCond is empty (defined as not isset or != '')
Ex 4. jdbg::pf($var, 'area');
simply prints $var overriding the printer assigned in jdbg plugin configuration and uses instead textarea
You are able to print in the following formats:
- krumo (http://krumo.sourceforge.net)
- kint (http://code.google.com/p/kint)
- within a textarea
- using var_dump (good enough if you have xdebug in place)
- dump to log file
In the plugin configuration you would be able to control:
- krumo skin (5 predefined choices are available)
- if the print of jdbg should be done regardless of the global Joomla debug mode is on or not
- the default printing format for jdbg according to the options above
- if the print should be on site, admin or both
- if printing option is to file the location and name of the file, and whether the log file should be reset at each page load and if timestamp should be appended to log file prior to dumping value (including delta time measured from the first time jdbg was called in milliseconds)
Conditions for print are set according to the following:
- if given parameter value equivalence with given test value
- if given parameter value match with a given regular expression
- if given parameter is empty or not empty (2 constants defined by jdbg, thus thus jdbg::ISEMPTY or jdbg::ISNOTEMPTY)
In additon you would be able to control the execution flow and call exit after print by using the jdbg::pe version.
You can override the plugin configurations by making the call to jdbg::pf instead with the following function-signature:
jdbg::pf($val, $mode = 'pre', $var_val = null, $var_cond = null, $exit_mode = jdbg::EXIT_DONT)
dump is the default function applied. If any of the functions (other than dump are to be applied then do use "krumo krumo_function").
Available functions are documented here.
There is really not that much more to say about jdbg, but as you probably can see it can make your debugging much easier
Any feedback, bug report or support request is welcome.
At the download site 2 different versions J1.5 compatible (not maintained anymore) and J2.5+ compatible versions are available.