diff 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
line wrap: on
line diff
--- a/common/logging.h	Mon Apr 28 09:18:55 2014 +0000
+++ b/common/logging.h	Mon Apr 28 09:19:29 2014 +0000
@@ -81,7 +81,17 @@
  *
  * Prints an error to stderr
  */
-#define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__);
+#ifdef WIN32
+#  define ERRORPRINTF(fmt, ...) \
+  { \
+    char buf[512]; \
+    snprintf(buf, 511, "ERROR: " fmt, ##__VA_ARGS__); \
+    buf[511] = '\0'; \
+    OutputDebugStringA(buf); \
+  }
+#else
+# define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__);
+#endif
 
 #define PRINTLASTERROR(msg) \
   char *my_error = getLastErrorMsg(); \

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