[Typo3-dev] using devLog instead of debug in the core?

Martin T. Kutschker Martin.no5pam.Kutschker at blackbox.n0spam.net
Sun Feb 6 18:54:47 CET 2005


Kasper Skårhøj wrote:
> It was made as a way of logging for development purposes. THe idea is
> that the presenation of the log is done by an extension which can either
> output it to browser, save to a file, or something else.
> 
> It was made when I was working on "realurl" extension. However old habit
> makes me continuously use "debug()" so I didn't use it since then. 
> 
> If you have an idea for it, please let us know.

Another idea:

In t3lib_div::devLog change

$params = array('msg'=>$msg, 'extKey'=>$extKey,
                 'severity'=>$severity, 'dataVar'=>$dataVar);

to

// php 4.3 or higher
if (function_exists('debug_backtrace')) {
   $backTrace = debug_backtrace();
   array_shift($backTrace);
} else {
   $backTrace = array();
}
$params = array('msg'=>$msg, 'extKey'=>$extKey,
                 'severity'=>$severity, 'dataVar'=>$dataVar,
                 'backTrace'=$backTrace );

As an alternative the backtrace could be passed like this:

// use $backTrace as fake reference
t3lib_div::callUserFunction($hookMethod,$params,$backTrace);

Note: the array shifting is done to avoid the inclusion of the devLog() 
call in the back trace.

An extension that implements the logging hook could either store the 
serialized array or the result of t3lib_div::view_array($backTrace).

Masi




More information about the TYPO3-dev mailing list