annotate common/logging.h @ 301:aec9008c3b30

Add note about libnss in build deps
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 03 Apr 2014 14:26:43 +0200
parents b033b16dd290
children b1059360a0c7
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
287
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
59 /**
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
60 * @def DEBUGMSG(msg)
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
61 * @brief Prints a static debug message
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
62 *
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
63 * If DEBUGOUTPUT is defined this. Prints a debug message
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
64 * to stdout on Unix systems. On Windows OutputDebugString is used.
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
65 */
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
66 #ifdef DEBUGOUTPUT
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
67 # ifdef WIN32
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
68 # define DEBUGMSG(msg) OutputDebugString (msg);
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
69 # else
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
70 # define DEBUGMSG(msg) printf (DEBUGPREFIX "DEBUG: " msg "\n");
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
71 # endif
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
72 #else
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
73 # define DEBUGPRINTF(fmt, ...)
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
74 #endif
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
75
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 * @def ERRORPRINTF(fmt, ...)
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
79 * @brief Debug printf
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
80 *
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
81 * Prints an error to stderr
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
82 */
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
83 #define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__);
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
84
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
85
b033b16dd290 Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents: 252
diff changeset
86
252
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
87 #ifdef __cplusplus
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
88 }
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
89 #endif
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
90
bd7fb50078b4 Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
91 #endif /* COMMON_LOGGING_H */

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