Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 2 and Version 3 of code/howto/Output


Ignore:
Timestamp:
Aug 22, 2011, 2:58:29 PM (13 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/howto/Output

    v2 v3  
    22[[TracNav(TracNav/TOC_Development)]]
    33
    4 First you have to include [wiki:Debug Debug.h]:
     4First you have to include [wiki:Output Output.h]:
    55{{{
    6 #include "util/Debug.h"
     6#include "util/Output.h"
    77}}}
    88
    9 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:
     9Then 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:
    1010{{{
    11 COUT(1) << "This is some cool output!" << std::endl;
     11orxout(user_info) << "This is some cool output!" << endl;
    1212}}}
    1313
    14 Each level has it's meaning:
     14Every 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.
    1515
    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].
     16See [wiki:Output] for more information about levels, contexts, and the general usage of orxout().