Feature #86220
closedenhanced debug methods
0%
Description
The debug function at typo3_src-9.3.3/typo3/sysext/core/Resources/PHP/GlobalDebugFunctions.php is not sufficient for big TYPO3 extensions. If you have more than 1000 debug entries then the generated debug output will be too much. And it takes too long time to search for anything in the debug output.
In TYPO3 before 9.3 there have been 2 useful debug functions:
debugBegin
debugEnd
They should be kept for compatibility reason or at least be substituted by a similar function.
debugBegin has been a starting control to turn the debug output on. debugEnd has been a stop marker for the debug output.
However a more sophisticated method would help for better debugging.
debugControl with an indefinite number of parameters.
There you can set attributes for the output like colors, text sizes, email adresses, extension keys of a person who needs to be notified with debug details if a special part of code has been entered. This could also make it possible to define in a debug extension, that only the output of extension news is generated. If a debugControl(START, EXT_KEY, 'news'); has been executed, then this signifies the start of the debug output for extension news. debugControl(END, EXT_KEY, 'news'); marks the end for news.
All these code functions needs not be implemented in TYPO3. However the empty functions and an extensibility by slots are needed.
And also a return value of debug should be given.
A negative value could mean that the program execution should be shorter than normal.
debug($a, 'variable $a');
The debug extension could determine that if $a == 'special' then the program execution should return. Even a user with a special front end user group or IP address could have less debug output than another user. E.g. you want to test a new PHP code which must only be executed by a special tester. Other persons should never run into the PHP code which is not stable enough. If an email address 'test@user.de' has been entered, then the following code should be executed, otherwise not.
Then the caller could run:
if (debug($a, 'variable $a') < 0) return;
if (debugControl(TEST_USER) < 0) return;
Maybe some constants for this could be defined with TYPO3.