Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of code/howto/Output


Ignore:
Timestamp:
Sep 25, 2008, 1:07:19 AM (16 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/howto/Output

    v1 v1  
     1= HowTo: Output =
     2[[TracNav(TracNav/TOC_Development)]]
     3
     4First you have to include Debug.h:
     5{{{
     6#include "util/Debug.h"
     7}}}
     8
     9Then you can use the '''COUT''' macro instead of std::cout (note: printf is obsolete). COUT works almost like std::cout, but you can assign a level to your output:
     10{{{
     11COUT(1) << "This is some cool output!" << std::endl;
     12}}}
     13
     14Each level has it's meaning:
     15
     16|| 0 || Gets always displayed and is meant for very important messages ||
     17|| 1 || Errors. Something seriously bad has happened. Mostly in combination with assert() or an exception. ||
     18|| 2 || Warnings. The issue is not too bad, but everyone should see that something bad has happened. ||
     19|| 3 || Informations about what's happening ||
     20|| 4 || Debug information. Can be quite a lot of text. ||
     21|| 5 || Verbose debug information. That would be overkill in the shell or console. View the log! ||
     22|| 6 || Extreme debug information. You better use grep or another regex tool to read a log file for level 6. ||
     23
     24Every output through COUT will be sent to each the console, the logfile and the [wiki:Shell]. There is a [wiki:howto/ConfigFile configurable] maximal output level for every device. If the level of your output is > the maximal level of a device, it wont be displayed. But don't use COUT(0) all the time, because the user SHOULD be able to deactivate your output unless it's REALLY important.