comparison 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
comparison
equal deleted inserted replaced
1059:f638eb1f3b0f 1060:317ee9dc4684
68 * 68 *
69 * Prints to stderr if DEBUGOUTPUT is defined. 69 * Prints to stderr if DEBUGOUTPUT is defined.
70 */ 70 */
71 #ifdef DEBUGOUTPUT 71 #ifdef DEBUGOUTPUT
72 # ifndef WIN32 72 # ifndef WIN32
73 # define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); 73 # define DEBUGPRINTF(fmt, ...) if (g_debug) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
74 # else /* WIN32 */ 74 # else /* WIN32 */
75 # define DEBUGPRINTF(fmt, ...) \ 75 # define DEBUGPRINTF(fmt, ...) \
76 if (g_debug) \
76 { \ 77 { \
77 char buf[512]; \ 78 char buf[512]; \
78 snprintf(buf, 511, "DEBUG: " fmt, ##__VA_ARGS__); \ 79 snprintf(buf, 511, "DEBUG: " fmt, ##__VA_ARGS__); \
79 buf[511] = '\0'; \ 80 buf[511] = '\0'; \
80 OutputDebugStringA(buf); \ 81 OutputDebugStringA(buf); \
111 #define PRINTLASTERROR(msg) \ 112 #define PRINTLASTERROR(msg) \
112 char *my_error = getLastErrorMsg(); \ 113 char *my_error = getLastErrorMsg(); \
113 if (my_error) { \ 114 if (my_error) { \
114 ERRORPRINTF(msg" : %s\n", my_error); \ 115 ERRORPRINTF(msg" : %s\n", my_error); \
115 free (my_error); \ 116 free (my_error); \
116 } \ 117 } else \
117 ERRORPRINTF ("Failed to get error information\n"); 118 ERRORPRINTF ("Failed to get error information\n");
118 119
119 120
120 /** 121 /**
121 * @brief log an informational message into the syslog / event log 122 * @brief log an informational message into the syslog / event log
122 * 123 *

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