| 1 | = debug.h = |
| 2 | file-link: source:/trunk/src/defs/debug.h#HEAD |
| 3 | |
| 4 | == IDEA == |
| 5 | The idea behing the debugging system is, that all the output can be redirected, redesigned, and if you want be disabled. |
| 6 | |
| 7 | == Usage == |
| 8 | In the code you wold make an output like this: |
| 9 | {{{ |
| 10 | #!cpp |
| 11 | PRINT(4)("print cool some text: %s\n", text); |
| 12 | }}} |
| 13 | This would tell the debugg-engine that output is to be printed if we are in mode '''4''' which is debug (see listing below). |
| 14 | The output of this would look as follows (given text = "some very cool text"): |
| 15 | {{{ |
| 16 | print some cool text: some very cool text |
| 17 | }}} |
| 18 | As you may have noticed, there are two pairs of brackets ()(). |
| 19 | The first one donates the debug-level, the second one the output in printf-style format. |
| 20 | |
| 21 | Alternatively you could also output via |
| 22 | {{{ |
| 23 | #!cpp |
| 24 | PRINTF([level])([output-stuff]); |
| 25 | }}} |
| 26 | The joke with PRINTF (notice the F at the end (it is the only thing that changes)) is, that in addition to just printing the output, it appends the level, code-file and file-line, where the error occured in the following from: |
| 27 | (LEVEL)::[filename]:[linenumber]:[output] |
| 28 | |
| 29 | try it out for yourself. |
| 30 | |
| 31 | == what is the meaning of the debug-level == |
| 32 | || 0 || just output || |
| 33 | || 1 || ERROR (EE) || |
| 34 | || 2 || WARNING (WW) || |
| 35 | || 3 || INFORMATION (II) || |
| 36 | || 4 || DEBUG (DD) || |
| 37 | || 5 || Very much DEBUG (VD) || |
| 38 | |
| 39 | == select the level of output == |
| 40 | the level of output is the maximum debug-mode, that can be outputted |
| 41 | * have a look at [source:/trunk/src/defs/debug.h#HEAD debug.h] |
| 42 | |
| 43 | everything is there. |
| 44 | |
| 45 | |
| 46 | == redirected to where?? == |
| 47 | all the output generated with the Debugging engine is redirected to the Shell's Buffer, where it can be appendet to the Shell itself, and where output will be stored some line-lenght long. |
| 48 | * see [wiki:Shell Shell] |
| 49 | |
| 50 | |