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