Mercurial > trustbridge
annotate common/logging.h @ 1349:7840851b26b9
Added tag 0.9.4 for changeset b90df38bb6dc
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 30 Oct 2014 11:19:28 +0100 |
parents | 317ee9dc4684 |
children | 318e8c5c4f85 |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
252
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
8 #ifndef COMMON_LOGGING_H |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 #define COMMON_LOGGING_H |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
11 #ifdef __cplusplus |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 extern "C" { |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 #endif |
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 /* |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 * @file |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 * @brief Logging and debugging functions |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 */ |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 |
503
7f2cb85288d0
Move printlasterror into logging
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
20 #include <stdio.h> |
623
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
21 #include <stdbool.h> |
503
7f2cb85288d0
Move printlasterror into logging
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
22 |
615
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
23 /** @def Maximum length of log messages */ |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
24 #define MAX_LOG 511 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
25 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
26 /** @def The name used for logging */ |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
27 #define LOG_NAME "TrustBridge" |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
28 |
1058
fe2c6666b462
(issue46) Add debug option to trustbridge client application
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
29 extern bool g_debug; |
fe2c6666b462
(issue46) Add debug option to trustbridge client application
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
30 |
252
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 #ifdef WIN32 |
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 #include <windows.h> |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
34 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
35 /** @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
|
36 * returned by GetLastError |
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 * @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
|
39 **/ |
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 char *getLastErrorMsg(); |
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 #endif |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
44 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
45 /** |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
46 * @def DEBUGOUTPUT |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
47 * @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
|
48 * |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
49 * 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
|
50 */ |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
51 #ifndef RELEASE_BUILD |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
52 #define DEBUGOUTPUT |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
53 #endif |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
54 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
55 /** |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
56 * @def DEBUGPREFIX |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
57 * @brief A string prepended to debug output. |
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 * 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
|
60 */ |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
61 #ifndef DEBUGPREFIX |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
62 #define DEBUGPREFIX "" |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
63 #endif |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
64 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
65 /** |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
66 * @def DEBUGPRINTF(fmt, ...) |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
67 * @brief Debug printf |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
68 * |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
69 * Prints to stderr if DEBUGOUTPUT is defined. |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
70 */ |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
71 #ifdef DEBUGOUTPUT |
329
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
72 # ifndef WIN32 |
1060
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1058
diff
changeset
|
73 # define DEBUGPRINTF(fmt, ...) if (g_debug) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); |
329
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
74 # else /* WIN32 */ |
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
75 # define DEBUGPRINTF(fmt, ...) \ |
1060
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1058
diff
changeset
|
76 if (g_debug) \ |
329
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
77 { \ |
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
78 char buf[512]; \ |
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
79 snprintf(buf, 511, "DEBUG: " fmt, ##__VA_ARGS__); \ |
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
80 buf[511] = '\0'; \ |
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
81 OutputDebugStringA(buf); \ |
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
82 } |
b1059360a0c7
Debugprintf with output debug string on windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
287
diff
changeset
|
83 # endif /* WIN32 */ |
287
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
84 #else |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
85 # define DEBUGPRINTF(fmt, ...) |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
86 #endif |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
87 |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
88 /** |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
89 * @def ERRORPRINTF(fmt, ...) |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
90 * @brief Debug printf |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
91 * |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
92 * Prints an error to stderr |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
93 */ |
504
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
94 #ifdef WIN32 |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
95 # define ERRORPRINTF(fmt, ...) \ |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
96 { \ |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
97 char buf[512]; \ |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
98 snprintf(buf, 511, "ERROR: " fmt, ##__VA_ARGS__); \ |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
99 buf[511] = '\0'; \ |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
100 OutputDebugStringA(buf); \ |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
101 } |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
102 #else |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
103 # define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); |
3cf72c5282e8
Redirect errorprintf to output debug string on windows
Andre Heinecke <aheinecke@intevation.de>
parents:
503
diff
changeset
|
104 #endif |
287
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
105 |
513
5e2af38266f6
Add documentation for printlasterror
Andre Heinecke <aheinecke@intevation.de>
parents:
504
diff
changeset
|
106 /** |
5e2af38266f6
Add documentation for printlasterror
Andre Heinecke <aheinecke@intevation.de>
parents:
504
diff
changeset
|
107 * @def PRINTLASTERROR(msg) |
5e2af38266f6
Add documentation for printlasterror
Andre Heinecke <aheinecke@intevation.de>
parents:
504
diff
changeset
|
108 * @brief Prints the last windows error with a custom message |
5e2af38266f6
Add documentation for printlasterror
Andre Heinecke <aheinecke@intevation.de>
parents:
504
diff
changeset
|
109 * |
5e2af38266f6
Add documentation for printlasterror
Andre Heinecke <aheinecke@intevation.de>
parents:
504
diff
changeset
|
110 * Prints an error to stderr |
5e2af38266f6
Add documentation for printlasterror
Andre Heinecke <aheinecke@intevation.de>
parents:
504
diff
changeset
|
111 */ |
503
7f2cb85288d0
Move printlasterror into logging
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
112 #define PRINTLASTERROR(msg) \ |
7f2cb85288d0
Move printlasterror into logging
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
113 char *my_error = getLastErrorMsg(); \ |
7f2cb85288d0
Move printlasterror into logging
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
114 if (my_error) { \ |
7f2cb85288d0
Move printlasterror into logging
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
115 ERRORPRINTF(msg" : %s\n", my_error); \ |
7f2cb85288d0
Move printlasterror into logging
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
116 free (my_error); \ |
1060
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1058
diff
changeset
|
117 } else \ |
317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1058
diff
changeset
|
118 ERRORPRINTF ("Failed to get error information\n"); |
287
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
119 |
b033b16dd290
Add OutputDebugString macro
Andre Heinecke <aheinecke@intevation.de>
parents:
252
diff
changeset
|
120 |
615
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
121 /** |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
122 * @brief log an informational message into the syslog / event log |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
123 * |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
124 * The message length is limited to MAX_LOG characters. Log messages |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
125 * are expected to be in UTF-8 encoding. |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
126 * |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
127 * Function paramters are the same as for the printf familiy. |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
128 */ |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
129 void syslog_info_printf(const char *format, ...); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
130 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
131 /** |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
132 * @brief log an error message into the syslog / event log |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
133 * |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
134 * The message length is limited to MAX_LOG characters. Log messages |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
135 * are expected to be in UTF-8 encoding. |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
136 * |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
137 * Function paramters are the same as for the printf familiy. |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
138 */ |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
139 void syslog_error_printf(const char *format, ...); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
513
diff
changeset
|
140 |
623
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
141 /** |
625
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
142 * @brief log a certificate install / remove event from base64 data. |
623
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
143 * |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
144 * Logs a message in the event / syslog to mark a certificate |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
145 * installation or removal. |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
146 * |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
147 * @param[in] store name of the certificate store. |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
148 * @param[in] b64cert base64 encoded certificate. |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
149 * @param[in] install weather to log this as installation or removal |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
150 */ |
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
151 void log_certificate(const char *store, char *b64cert, bool install); |
904
f89b41fa7048
Fix whitespace errors
Andre Heinecke <andre.heinecke@intevation.de>
parents:
625
diff
changeset
|
152 |
625
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
153 /** |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
154 * @brief log a certificate install / remove event from der data. |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
155 * |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
156 * Logs a message in the event / syslog to mark a certificate |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
157 * installation or removal. |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
158 * |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
159 * @param[in] store name of the certificate store. |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
160 * @param[in] der_data pointer to der data of the certificate. |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
161 * @param[in] der_size size of the der_data |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
162 * @param[in] install weather to log this as installation or removal |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
163 */ |
2303caf56dbb
Add logging function for der data and add logging to NSS installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
623
diff
changeset
|
164 void log_certificate_der(const char *store, unsigned char *der_data, size_t der_size, bool install); |
623
5042ace08cba
Add certificate specific logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
615
diff
changeset
|
165 |
252
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
166 #ifdef __cplusplus |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
167 } |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
168 #endif |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
169 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
170 #endif /* COMMON_LOGGING_H */ |