Would be fine to have more flexibility of the debugging.
Currently the debugging has only 2 levels, and affects the whole script (Multi Level Debugging, MLD).
'debug_level' => '0', # can be set 0-2
This method returns the current debug level.
You may provide one argument which sets a new debug level.
0 means no debugging, 1 means basic debugging, 2 means heavy debugging.
If providing a new debug level, the old debug level is returned.
I would suggest a Functional Multi Level Debugging (FMLD) system, where the debugging of each function could be separately turned on-off.
The current 'debug_level' would be renamed to 'debug_level_general'. It would still control the debug level of the full LSQL script.
The 'debug_level_functions' would contain, a hash, where each key=value pairs controls debugging of a function.
The advantage of the new FMLD debug system, that while we can still have full debug control over the full script generally, but we can even just debug a function of the whole script without the need to have display all the sql queries and other currently unuseful options.
Example:
...
'debug_level_general' => '0', # current 'debug_level' option with 2 debug levels
'debug_level_functions' => {
"Plugins::Extended_link::mycode" => '2',
"Links::Build::site_html_category" => '1' }
...
}
In the example above, we will have displayed the debugging messages of the Plugins::Extended_link::mycode plugin function with debug level '2', and the debugging messages of Links::Build::site_html_category function with debug level '1'.
Only these debug texts will be displayed, nothing else, because the 'debug_level_general' is turned off.
Good idea, isn't?
If we want to turn on the general debugging, we just set 'debug_level_general' to '1', which will override the 'debug_level_functions' debugging, and all debug messages will be displayed.
The debug conditions could be coded as following:
- the debug level of functions from 'debug_level_functions', is assigned to the corresponding variable in the Links::init function.
- After Links::init, the variable levels of the example would be: $Plugins::Extended_link::mycode::DEBUG has debug level 2 and $Links::Build::site_html_category::DEBUG has debug level 1.
- debugging can be coded that way in the functions itself:
print "The Extended_link debugging is turned on" if (
$Plugins::Extended_link::mycode::DEBUG or $CFG->{debug_level_general}
);
}
Of course $GT::Plugins::DEBUG could be still used to enable/disable plugin debugging generally.
Opinions, ideas are welcome.
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Currently the debugging has only 2 levels, and affects the whole script (Multi Level Debugging, MLD).
'debug_level' => '0', # can be set 0-2
Quote:
debug_level This method returns the current debug level.
You may provide one argument which sets a new debug level.
0 means no debugging, 1 means basic debugging, 2 means heavy debugging.
If providing a new debug level, the old debug level is returned.
I would suggest a Functional Multi Level Debugging (FMLD) system, where the debugging of each function could be separately turned on-off.
The current 'debug_level' would be renamed to 'debug_level_general'. It would still control the debug level of the full LSQL script.
The 'debug_level_functions' would contain, a hash, where each key=value pairs controls debugging of a function.
The advantage of the new FMLD debug system, that while we can still have full debug control over the full script generally, but we can even just debug a function of the whole script without the need to have display all the sql queries and other currently unuseful options.
Example:
Code:
{ ...
'debug_level_general' => '0', # current 'debug_level' option with 2 debug levels
'debug_level_functions' => {
"Plugins::Extended_link::mycode" => '2',
"Links::Build::site_html_category" => '1' }
...
}
In the example above, we will have displayed the debugging messages of the Plugins::Extended_link::mycode plugin function with debug level '2', and the debugging messages of Links::Build::site_html_category function with debug level '1'.
Only these debug texts will be displayed, nothing else, because the 'debug_level_general' is turned off.
Good idea, isn't?
If we want to turn on the general debugging, we just set 'debug_level_general' to '1', which will override the 'debug_level_functions' debugging, and all debug messages will be displayed.
The debug conditions could be coded as following:
- the debug level of functions from 'debug_level_functions', is assigned to the corresponding variable in the Links::init function.
- After Links::init, the variable levels of the example would be: $Plugins::Extended_link::mycode::DEBUG has debug level 2 and $Links::Build::site_html_category::DEBUG has debug level 1.
- debugging can be coded that way in the functions itself:
Code:
sub mycode { print "The Extended_link debugging is turned on" if (
$Plugins::Extended_link::mycode::DEBUG or $CFG->{debug_level_general}
);
}
Of course $GT::Plugins::DEBUG could be still used to enable/disable plugin debugging generally.
Opinions, ideas are welcome.
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...