Mercurial > trustbridge
annotate common/debug.h @ 230:92b1e5ed2d5f
Cleanup and documentation in debugging macros.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 28 Mar 2014 10:32:55 +0100 |
parents | 19de529ce7fb |
children |
rev | line source |
---|---|
172
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
1 #ifndef DEBUG_H |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
2 #define DEBUG_H |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
3 |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
4 /** |
230
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
5 * @file |
172
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
6 * @brief Helper macros for debugging |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
7 */ |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
8 |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
9 /** |
230
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
10 * @def DEBUGOUTPUT |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
11 * @brief If defined code for extra debugging output will be generated. |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
12 * |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
13 * Will be defined if current build is not an RELEASE_BUILD. |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
14 */ |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
15 #ifndef RELEASE_BUILD |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
16 #define DEBUGOUTPUT |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
17 #endif |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
18 |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
19 /** |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
20 * @def DEBUGPREFIX |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
21 * @brief A string prepended to debug output. |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
22 * |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
23 * Should be defined to indicate which module created the output. |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
24 */ |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
25 #ifndef DEBUGPREFIX |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
26 #define DEBUGPREFIX "" |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
27 #endif |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
28 |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
29 /** |
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
30 * @def DEBUGPRINTF(fmt, ...) |
172
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
31 * @brief Debug printf |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
32 * |
230
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
33 * Prints to stderr if DEBUGOUTPUT is defined. |
172
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
34 */ |
230
92b1e5ed2d5f
Cleanup and documentation in debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
228
diff
changeset
|
35 #ifdef DEBUGOUTPUT |
228
19de529ce7fb
Moved debug prefix to macro and added component specific prefix.
Sascha Wilde <wilde@intevation.de>
parents:
227
diff
changeset
|
36 #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); |
172
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
37 #else |
227
29467940b07b
Fixed naming of debugging print macro.
Sascha Wilde <wilde@intevation.de>
parents:
172
diff
changeset
|
38 #define DEBUGPRINTF(fmt, ...) |
172
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
39 #endif |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
40 |
7b9545ad76f6
Added include file with debugging macros.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
41 #endif |