Debugging
The eZ debug™ utility is very useful when developing PHP code. The most frequently used functions
are writeDebug, writeNotice, writeWarning and writeError. These print a debug
message in different ways depending on the role of the message. For timing, use addTimingPoint before
and after time-consuming code. To print the debug results on screen, use printReport.
Some examples:
include_once( "lib/ezutils/classes/ezdebug.php" );
// write a temporary debug message
// (writeDebug messages should not be present in packaged code.)
eZDebug::writeDebug( "Test: " . $myVar );
// write a notice
eZDebug::writeNotice( "Image found" );
// write a warning
eZDebug::writeWarning( "Image not found, using default" );
// write an error
eZDebug::writeError( "Object not found, bailing.." );
// add a timing point
eZDebug::addTimingPoint( "Module Found" );
// insert some time-consuming code here....
eZDebug::addTimingPoint( "Module loading" );
// Print the results on screen.
// (In many cases you don't need this as it is called elsewhere.)
eZDebug::printReport();
Settings
The eZ debug™ library has some settings that can be edited in the file settings/site.ini.
You can enable debug information for one specific host, this is useful for debugging live systems.
You can choose to show the debug information inline in the browser or in a popup window. There is also a
setting to enable automatic or manual redirecting when jumping from a process page to a result page.
Sample settings for site.ini:
[DebugSettings]
# IP addresses which will get debug information
# Valid are: enabled, disabled or list of IP's separated by ;
DebugIP=10.0.2.3
# Use either disabled, inline or popup
Debug=inline
# Use either enabled or a an array of uris to match
DebugRedirection=disabled
|