Mercurial > trustbridge
comparison 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 |
comparison
equal
deleted
inserted
replaced
502:e551de11d8b6 | 503:7f2cb85288d0 |
---|---|
14 | 14 |
15 /* | 15 /* |
16 * @file | 16 * @file |
17 * @brief Logging and debugging functions | 17 * @brief Logging and debugging functions |
18 */ | 18 */ |
19 | |
20 #include <stdio.h> | |
19 | 21 |
20 #ifdef WIN32 | 22 #ifdef WIN32 |
21 | 23 |
22 #include <windows.h> | 24 #include <windows.h> |
23 | 25 |
79 * | 81 * |
80 * Prints an error to stderr | 82 * Prints an error to stderr |
81 */ | 83 */ |
82 #define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); | 84 #define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); |
83 | 85 |
86 #define PRINTLASTERROR(msg) \ | |
87 char *my_error = getLastErrorMsg(); \ | |
88 if (my_error) { \ | |
89 ERRORPRINTF(msg" : %s\n", my_error); \ | |
90 free (my_error); \ | |
91 } \ | |
92 ERRORPRINTF ("Failed to get error information\n"); | |
84 | 93 |
85 | 94 |
86 #ifdef __cplusplus | 95 #ifdef __cplusplus |
87 } | 96 } |
88 #endif | 97 #endif |