[TYPO3-ect] Debugging with lib/div
Elmar Hinz
elmar07 at googlemail.com
Mon Aug 6 14:04:24 CEST 2007
Stefan Geith wrote:
>
> Is there something available or planned for lib/div ?
Nothing.A debugger would be great.
>
> I think it would be usefull to have a debugger() in tx_lib_object, like
> already controller(), configurations() and parameters()
> -and/or-
> a _createDebugger() in tx_lib_controller->main()
>
A debugger object, that is availabe in the controller as $this->debugger.
It would only be created, if some debug flag is set to true i.e. in TS, FF
or install tool.
>
> There could be a debugger Interface and a default class DebuggerVoid()
> that doesn't do any output at all, but can be replaced (via TS) by a
> real (= more sophisticated) Debugger.
>
> I personally would like to have these functions:
> $debugger->debug($var) ... always debug $var
> $debugger->debugIfEnabled('xyz',$var)
> ... only debug if dodebug.xyz is set in TS
> $debugger->debugIfFieldIsSet('xyz',$fieldname,$var)
> ... only debug if content of dodebug.xyz==$fieldname;
> This is usefull e.g. to debug db-relations on a specific field
This is resulting in a long call for a quick debug:
$this->controller->debugger->debugIfFieldIsSet('xyz',$fieldname,$var);
Additionally the debugger doesn't know about the current object and its
internal $fields; To solve this another parameter is needed:
$this->controller->debugger->debugIfFieldIsSet($this, 'xyz',$fieldname
$var);
Maybe that could be solved by "shortcuts" on the level of tx_lib_object.
$this->debugIfFieldIsSet('xyz',$fieldname,$var);
function debugIfFieldIsSet('xyz',$fieldname,$var) {
if(is_object($this->controller->debugger))
$this->controller->debugger->debugIfFieldIsSet($this, 'xyz'
$fieldname,$var);
}
> $debugger->shortBacktrace($count=5,$minimize=0)
> ... that gives a condensed view of debug_backtrace
> Additionally:
> $debugger->forceDebug($val) ... where $val could come from
> the flexform of the plugin:
> $val<0 => never do any debug-output
> $val=0 => debug-output depending on TS .dodebug...
> $val>0 => output every debug-message available
>
> What do You think about this ?
>
> -
>
> Stefan
Regards
Elmar
More information about the TYPO3-team-extension-coordination
mailing list