comparison common/logging.h @ 504:3cf72c5282e8

Redirect errorprintf to output debug string on windows
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Apr 2014 09:19:29 +0000
parents 7f2cb85288d0
children 5e2af38266f6
comparison
equal deleted inserted replaced
503:7f2cb85288d0 504:3cf72c5282e8
79 * @def ERRORPRINTF(fmt, ...) 79 * @def ERRORPRINTF(fmt, ...)
80 * @brief Debug printf 80 * @brief Debug printf
81 * 81 *
82 * Prints an error to stderr 82 * Prints an error to stderr
83 */ 83 */
84 #define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); 84 #ifdef WIN32
85 # define ERRORPRINTF(fmt, ...) \
86 { \
87 char buf[512]; \
88 snprintf(buf, 511, "ERROR: " fmt, ##__VA_ARGS__); \
89 buf[511] = '\0'; \
90 OutputDebugStringA(buf); \
91 }
92 #else
93 # define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__);
94 #endif
85 95
86 #define PRINTLASTERROR(msg) \ 96 #define PRINTLASTERROR(msg) \
87 char *my_error = getLastErrorMsg(); \ 97 char *my_error = getLastErrorMsg(); \
88 if (my_error) { \ 98 if (my_error) { \
89 ERRORPRINTF(msg" : %s\n", my_error); \ 99 ERRORPRINTF(msg" : %s\n", my_error); \

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