Mercurial > trustbridge
comparison common/logging.h @ 287:b033b16dd290
Add OutputDebugString macro
This helps when debugging interprocess calls on Windows where
you do not get stdout on console
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 02 Apr 2014 13:48:31 +0000 |
parents | bd7fb50078b4 |
children | b1059360a0c7 |
comparison
equal
deleted
inserted
replaced
286:881ce5126f07 | 287:b033b16dd290 |
---|---|
54 #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); | 54 #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); |
55 #else | 55 #else |
56 #define DEBUGPRINTF(fmt, ...) | 56 #define DEBUGPRINTF(fmt, ...) |
57 #endif | 57 #endif |
58 | 58 |
59 /** | |
60 * @def DEBUGMSG(msg) | |
61 * @brief Prints a static debug message | |
62 * | |
63 * If DEBUGOUTPUT is defined this. Prints a debug message | |
64 * to stdout on Unix systems. On Windows OutputDebugString is used. | |
65 */ | |
66 #ifdef DEBUGOUTPUT | |
67 # ifdef WIN32 | |
68 # define DEBUGMSG(msg) OutputDebugString (msg); | |
69 # else | |
70 # define DEBUGMSG(msg) printf (DEBUGPREFIX "DEBUG: " msg "\n"); | |
71 # endif | |
72 #else | |
73 # define DEBUGPRINTF(fmt, ...) | |
74 #endif | |
75 | |
76 | |
77 /** | |
78 * @def ERRORPRINTF(fmt, ...) | |
79 * @brief Debug printf | |
80 * | |
81 * Prints an error to stderr | |
82 */ | |
83 #define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); | |
84 | |
85 | |
86 | |
59 #ifdef __cplusplus | 87 #ifdef __cplusplus |
60 } | 88 } |
61 #endif | 89 #endif |
62 | 90 |
63 #endif /* COMMON_LOGGING_H */ | 91 #endif /* COMMON_LOGGING_H */ |