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.
- 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?)
|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.|
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;