Changes between Version 2 and Version 3 of code/howto/Output
- Timestamp:
- Aug 22, 2011, 2:58:29 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
code/howto/Output
v2 v3 2 2 [[TracNav(TracNav/TOC_Development)]] 3 3 4 First you have to include [wiki: Debug Debug.h]:4 First you have to include [wiki:Output Output.h]: 5 5 {{{ 6 #include "util/ Debug.h"6 #include "util/Output.h" 7 7 }}} 8 8 9 Then you can use the ''' COUT''' macro instead of std::cout (note: printf is obsolete). COUTworks almost like std::cout, but you can assign a level to your output:9 Then you can use the '''orxout()''' function instead of std::cout (note: printf is obsolete). orxout() works almost like std::cout, but you can assign a level to your output: 10 10 {{{ 11 COUT(1) << "This is some cool output!" << std::endl;11 orxout(user_info) << "This is some cool output!" << endl; 12 12 }}} 13 13 14 E ach level has it's meaning:14 Every output through orxout() will be sent to the console, the logfile and the in-game-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 orxout(debug_output) all the time because the user SHOULD be able to deactivate your output unless it's REALLY important. 15 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 24 Every 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. 25 26 For more information, see [wiki:Debug]. 16 See [wiki:Output] for more information about levels, contexts, and the general usage of orxout().