comparison common/logging.h @ 252:bd7fb50078b4

Add logging.h for some logging / debug functions The stuff from debug.h is now in logging.h
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 01 Apr 2014 10:49:40 +0000
parents
children b033b16dd290
comparison
equal deleted inserted replaced
251:c596568fa45b 252:bd7fb50078b4
1 #ifndef COMMON_LOGGING_H
2 #define COMMON_LOGGING_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 /*
9 * @file
10 * @brief Logging and debugging functions
11 */
12
13 #ifdef WIN32
14
15 #include <windows.h>
16
17 /** @brief Gets the localized error message for the last error
18 * returned by GetLastError
19 *
20 * @returns utf8 error message that needs to be freed by the caller.
21 **/
22
23 char *getLastErrorMsg();
24
25 #endif
26
27 /**
28 * @def DEBUGOUTPUT
29 * @brief If defined code for extra debugging output will be generated.
30 *
31 * Will be defined if current build is not an RELEASE_BUILD.
32 */
33 #ifndef RELEASE_BUILD
34 #define DEBUGOUTPUT
35 #endif
36
37 /**
38 * @def DEBUGPREFIX
39 * @brief A string prepended to debug output.
40 *
41 * Should be defined to indicate which module created the output.
42 */
43 #ifndef DEBUGPREFIX
44 #define DEBUGPREFIX ""
45 #endif
46
47 /**
48 * @def DEBUGPRINTF(fmt, ...)
49 * @brief Debug printf
50 *
51 * Prints to stderr if DEBUGOUTPUT is defined.
52 */
53 #ifdef DEBUGOUTPUT
54 #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
55 #else
56 #define DEBUGPRINTF(fmt, ...)
57 #endif
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif /* COMMON_LOGGING_H */

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