Version 1 (modified by landauf, 16 years ago) (diff) |
---|
HowTo: Output
TracNav(TracNav/TOC_Development)?
First you have to include Debug.h:
#include "util/Debug.h"
Then 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:
COUT(1) << "This is some cool output!" << std::endl;
Each level has it's 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. |
Every output through COUT will be sent to each the console, the logfile and the Shell?. There is a 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.