diff 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
line wrap: on
line diff
--- a/common/logging.h	Wed Apr 02 13:47:24 2014 +0000
+++ b/common/logging.h	Wed Apr 02 13:48:31 2014 +0000
@@ -56,6 +56,34 @@
 #define DEBUGPRINTF(fmt, ...)
 #endif
 
+/**
+ * @def DEBUGMSG(msg)
+ * @brief Prints a static debug message
+ *
+ * If DEBUGOUTPUT is defined this. Prints a debug message
+ * to stdout on Unix systems. On Windows OutputDebugString is used.
+ */
+#ifdef DEBUGOUTPUT
+# ifdef WIN32
+#  define DEBUGMSG(msg) OutputDebugString (msg);
+# else
+#  define DEBUGMSG(msg) printf (DEBUGPREFIX "DEBUG: " msg "\n");
+# endif
+#else
+# define DEBUGPRINTF(fmt, ...)
+#endif
+
+
+/**
+ * @def ERRORPRINTF(fmt, ...)
+ * @brief Debug printf
+ *
+ * Prints an error to stderr
+ */
+#define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__);
+
+
+
 #ifdef __cplusplus
 }
 #endif

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