diff common/logging.h @ 503:7f2cb85288d0

Move printlasterror into logging
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Apr 2014 09:18:55 +0000
parents 17e1c8f37d72
children 3cf72c5282e8
line wrap: on
line diff
--- a/common/logging.h	Mon Apr 28 09:18:07 2014 +0000
+++ b/common/logging.h	Mon Apr 28 09:18:55 2014 +0000
@@ -17,6 +17,8 @@
  * @brief Logging and debugging functions
  */
 
+#include <stdio.h>
+
 #ifdef WIN32
 
 #include <windows.h>
@@ -81,6 +83,13 @@
  */
 #define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__);
 
+#define PRINTLASTERROR(msg) \
+  char *my_error = getLastErrorMsg(); \
+      if (my_error) { \
+        ERRORPRINTF(msg" : %s\n", my_error); \
+        free (my_error); \
+      } \
+  ERRORPRINTF ("Failed to get error information\n");
 
 
 #ifdef __cplusplus

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