comparison common/logging.h @ 329:b1059360a0c7

Debugprintf with output debug string on windows. Makes debugging with redirectred input easier
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 08 Apr 2014 14:52:31 +0000
parents b033b16dd290
children 17e1c8f37d72
comparison
equal deleted inserted replaced
328:18b31e2498a3 329:b1059360a0c7
49 * @brief Debug printf 49 * @brief Debug printf
50 * 50 *
51 * Prints to stderr if DEBUGOUTPUT is defined. 51 * Prints to stderr if DEBUGOUTPUT is defined.
52 */ 52 */
53 #ifdef DEBUGOUTPUT 53 #ifdef DEBUGOUTPUT
54 #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); 54 # ifndef WIN32
55 #else 55 # define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
56 #define DEBUGPRINTF(fmt, ...) 56 # else /* WIN32 */
57 #endif 57 # define DEBUGPRINTF(fmt, ...) \
58 58 { \
59 /** 59 char buf[512]; \
60 * @def DEBUGMSG(msg) 60 snprintf(buf, 511, "DEBUG: " fmt, ##__VA_ARGS__); \
61 * @brief Prints a static debug message 61 buf[511] = '\0'; \
62 * 62 OutputDebugStringA(buf); \
63 * If DEBUGOUTPUT is defined this. Prints a debug message 63 }
64 * to stdout on Unix systems. On Windows OutputDebugString is used. 64 # endif /* WIN32 */
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 65 #else
73 # define DEBUGPRINTF(fmt, ...) 66 # define DEBUGPRINTF(fmt, ...)
74 #endif 67 #endif
75
76 68
77 /** 69 /**
78 * @def ERRORPRINTF(fmt, ...) 70 * @def ERRORPRINTF(fmt, ...)
79 * @brief Debug printf 71 * @brief Debug printf
80 * 72 *

http://wald.intevation.org/projects/trustbridge/