jdbg is a nifty debugging tool that allows you to print in various formats and also enables you to set condition for the printing. It also has an option of dumping values to a predefined log file.
You are able to print with the following formats:
- krumo (http://krumo.sourceforge.net, which is included in the jdbg package and the default function dump is applied)
- pre-formatted (<pre>)
- within a textarea (<textarea>)
- using var_dump (good enough if you have xdebug in place)
- dump to log file where sequen
In the plugin configuration you would be able to configure:
- 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)
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)If you use this method you would in additon be able to control the execution flow and call exit after print.
To illustrate the use with some examples.
jdbg::p($varToBePrinted);simply prints $varToBePrinted with the printer assigned in jdbg plugin configuration
jdbg::p($varToBePrinted, $varToApplyConditionTo, "re:[a-z]+");prints $varToBePrinted with the printer assigned in jdbg plugin configuration only if $varToApplyConditionTo matches the given regular expression of [a-z]+
jdbg::p($varToBePrinted, $varToApplyConditionTo, jdbg::IS_EMPTY);prints $varToBePrinted with the printer assigned in jdbg plugin configuration only if $varToApplyConditionTo is empty (defined as not isset or != '')
jdbg::pf($varToBePrinted, 'area');simply prints $varToBePrinted overriding the printer assigned in jdbg plugin configuration and uses instead textarea
- Using krumo
When using krumo
dumpis the default function applied. If any of the functions (other than dump) are to be applied you would need to employ the override method according to above. Syntax for krumo function call is as follows:
"krumo"Available functions are documented here.
Please do use my contact form until I have the time to setup something better.
- Change log
2010-03-11 / v1.0
...you are of course welcome to support the effort in whatever way you see fit