annotate common/logging.h @ 394:7e0a188d6848

Load the last certificate list from data dir on startup.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 15 Apr 2014 16:43:45 +0200
parents b1059360a0c7
children 17e1c8f37d72
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
329
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
54 # ifndef WIN32
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
55 # define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__);
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
56 # else /* WIN32 */
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
57 # define DEBUGPRINTF(fmt, ...) \
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
58 { \
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
59 char buf[512]; \
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
60 snprintf(buf, 511, "DEBUG: " fmt, ##__VA_ARGS__); \
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
61 buf[511] = '\0'; \
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
62 OutputDebugStringA(buf); \
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
63 }
b1059360a0c7 Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents: 287
diff changeset
64 # endif /* WIN32 */
287
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
65 #else
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
66 # define DEBUGPRINTF(fmt, ...)
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
67 #endif
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
68
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
69 /**
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
70 * @def ERRORPRINTF(fmt, ...)
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
71 * @brief Debug printf
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
72 *
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
73 * Prints an error to stderr
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
74 */
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
75 #define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__);
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
76
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
77
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
78
252
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
79 #ifdef __cplusplus
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
80 }
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
81 #endif
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
82
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
83 #endif /* COMMON_LOGGING_H */

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