Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 1 (modified by landauf, 13 years ago) (diff)

Debug

Description

Debug.h is a header-file, defining several macros for easy-to-use debug-output into the console, the logfile and the ingame Shell with different debug-levels. Debug.h defines macros for COUT, which passes the text over to the OutputHandler? which handles the redirection of output to the different streams.

The user can set the desired maximal output levels for every device (console, logfile, Shell) in the config file? in the section of the class Core.

Macros

  • COUT(level) << text: Acts like std::cout, but with a debug-level.
  • CCOUT(level) << text: Like COUT, but adds "ClassName: " in front (only works for OrxonoxClasses)

Debug-levels

# Meaning
0 Gets always displayed and is meant for very important messages
1 Errors. Something seriously bad has happened. Mostly in combination with assert() or an exception.
2 Warnings. The issue is not too bad, but everyone should see that something bad has happened.
3 Informations about what's happening
4 Debug information. Can be quite a lot of text.
5 Verbose debug information. That would be overkill in the shell or console. View the log!
6 Extreme debug information. You better use grep or another regex tool to read a log file for level 6.

Examples

COUT(4) << "Start executing the function..." << std::endl;

bool success = functionWithAMeaningfulReturnValue(params);

COUT(4) << "...finished executing the function." << std::endl;


if (success)
  COUT(3) << "Info: The execution of the function was successful." << std::endl;
else
  COUT(1) << "Error: The execution of the function failed." << std::endl;