Mercurial > trustbridge
changeset 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 | 881ce5126f07 |
children | c4a989a0d6cf |
files | common/logging.h |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
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