Project

General

Profile

Actions

Feature #86220

closed

enhanced debug methods

Added by Franz Holzinger over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
-
Start date:
2018-09-10
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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 '' 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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #23899: add a control function for debuggingClosed2010-11-01

Actions
Actions #1

Updated by Christian Kuhn over 5 years ago

I don't think we should/will introduce new global functions again.

Actions #2

Updated by Georg Ringer over 5 years ago

  • Status changed from New to Rejected

this sounds like a lot of business logic which you can always add to your custom extension.

I reject that for the core.

Actions #3

Updated by Franz Holzinger over 5 years ago

Yes, I intend to add all the logic to the extension. I did not make any other proposal.

But I cannot define a global debug control function in my extension.

And the global ERROR variable has been removed in TYPO3 9 as well as the debugBegin and debugEnd methods. There have been good reasons that these did exist in the past.
Kasper Skårhøj and Renè Fritz had introduced this into TYPO3.

To better understand the needs, just look into the code of
https://github.com/colorcube/cc_feinfo/blob/master/Classes/FeInfo.php

function debugvar($var, $name = '', $level = 3, $recursive = false)

The debug function should add more variables at the end.

function debug($variable = '', $title = null, $group = null, ...$parameters) {

Reason: This gives most flexibility to extensions. E.g. the call can be:

debug($var, 'Variable $var', null, 'news', 'developer2', 'topic3', 'bug#11');

see https://www.codewars.com/kata/php-functions-splat-operator
Then the resulting debug files can be split depending on these parameters. A file debugNews.html, a file developer2.html, a file topic3.html and a file bug11.html can be generated during one debug execution process.
This would help a lot on big TYPO3 projects with many developers and more than thousand debug lines.

Actions #4

Updated by Franz Holzinger over 5 years ago

  • Related to Feature #23899: add a control function for debugging added
Actions

Also available in: Atom PDF