diff common/logging.h @ 1060:317ee9dc4684

(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 09 Sep 2014 18:49:02 +0200
parents fe2c6666b462
children 318e8c5c4f85
line wrap: on
line diff
--- a/common/logging.h	Tue Sep 09 18:00:37 2014 +0200
+++ b/common/logging.h	Tue Sep 09 18:49:02 2014 +0200
@@ -70,9 +70,10 @@
  */
 #ifdef DEBUGOUTPUT
 # ifndef WIN32
-#  define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
+#  define DEBUGPRINTF(fmt, ...) if (g_debug) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
 # else /* WIN32 */
 #  define DEBUGPRINTF(fmt, ...) \
+ if (g_debug) \
   { \
     char buf[512]; \
     snprintf(buf, 511, "DEBUG: " fmt, ##__VA_ARGS__); \
@@ -113,8 +114,8 @@
       if (my_error) { \
         ERRORPRINTF(msg" : %s\n", my_error); \
         free (my_error); \
-      } \
-  ERRORPRINTF ("Failed to get error information\n");
+      } else \
+    ERRORPRINTF ("Failed to get error information\n");
 
 
 /**

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