diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-09-02 16:06:53 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-09-03 15:29:26 -0500 |
commit | 85735f8b50a9dae190b08abe339aeda7a447a30b (patch) | |
tree | 29ea037c5f2faad2797da3affe68c2d8c83665c6 /src/libs | |
parent | 75bc4c3bcf2dcb85fdc642547e339f54775db43a (diff) | |
download | wix-85735f8b50a9dae190b08abe339aeda7a447a30b.tar.gz wix-85735f8b50a9dae190b08abe339aeda7a447a30b.tar.bz2 wix-85735f8b50a9dae190b08abe339aeda7a447a30b.zip |
Move logutil docs into header and standardize inline wrapper methods.
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/logutil.h | 202 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/logutil.cpp | 165 |
2 files changed, 181 insertions, 186 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/logutil.h b/src/libs/dutil/WixToolset.DUtil/inc/logutil.h index 8f38e0ce..0ad8510a 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/logutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/logutil.h | |||
@@ -24,14 +24,29 @@ typedef HRESULT (DAPI *PFN_LOGSTRINGWORKRAW)( | |||
24 | // structs | 24 | // structs |
25 | 25 | ||
26 | // functions | 26 | // functions |
27 | /******************************************************************** | ||
28 | IsLogInitialized - Checks if log is currently initialized. | ||
29 | ********************************************************************/ | ||
27 | BOOL DAPI IsLogInitialized(); | 30 | BOOL DAPI IsLogInitialized(); |
28 | 31 | ||
32 | /******************************************************************** | ||
33 | IsLogOpen - Checks if log is currently initialized and open. | ||
34 | ********************************************************************/ | ||
29 | BOOL DAPI IsLogOpen(); | 35 | BOOL DAPI IsLogOpen(); |
30 | 36 | ||
37 | /******************************************************************** | ||
38 | LogInitialize - initializes the logutil API | ||
39 | |||
40 | ********************************************************************/ | ||
31 | void DAPI LogInitialize( | 41 | void DAPI LogInitialize( |
32 | __in_opt HMODULE hModule | 42 | __in_opt HMODULE hModule |
33 | ); | 43 | ); |
34 | 44 | ||
45 | /******************************************************************** | ||
46 | LogOpen - creates an application log file | ||
47 | |||
48 | NOTE: if wzExt is null then wzLog is path to desired log else wzLog and wzExt are used to generate log name | ||
49 | ********************************************************************/ | ||
35 | HRESULT DAPI LogOpen( | 50 | HRESULT DAPI LogOpen( |
36 | __in_z_opt LPCWSTR wzDirectory, | 51 | __in_z_opt LPCWSTR wzDirectory, |
37 | __in_z LPCWSTR wzLog, | 52 | __in_z LPCWSTR wzLog, |
@@ -42,13 +57,26 @@ HRESULT DAPI LogOpen( | |||
42 | __out_z_opt LPWSTR* psczLogPath | 57 | __out_z_opt LPWSTR* psczLogPath |
43 | ); | 58 | ); |
44 | 59 | ||
60 | /******************************************************************** | ||
61 | LogDisable - closes any open files and disables in memory logging. | ||
62 | |||
63 | ********************************************************************/ | ||
45 | void DAPI LogDisable(); | 64 | void DAPI LogDisable(); |
46 | 65 | ||
66 | /******************************************************************** | ||
67 | LogRedirect - Redirects all logging strings to the specified | ||
68 | function - or set NULL to disable the hook | ||
69 | ********************************************************************/ | ||
47 | void DAPI LogRedirect( | 70 | void DAPI LogRedirect( |
48 | __in_opt PFN_LOGSTRINGWORKRAW vpfLogStringWorkRaw, | 71 | __in_opt PFN_LOGSTRINGWORKRAW vpfLogStringWorkRaw, |
49 | __in_opt LPVOID pvContext | 72 | __in_opt LPVOID pvContext |
50 | ); | 73 | ); |
51 | 74 | ||
75 | /******************************************************************** | ||
76 | LogRename - Renames a logfile, moving its contents to a new path, | ||
77 | and re-opening the file for appending at the new | ||
78 | location | ||
79 | ********************************************************************/ | ||
52 | HRESULT DAPI LogRename( | 80 | HRESULT DAPI LogRename( |
53 | __in_z LPCWSTR wzNewPath | 81 | __in_z LPCWSTR wzNewPath |
54 | ); | 82 | ); |
@@ -61,52 +89,119 @@ void DAPI LogUninitialize( | |||
61 | __in BOOL fFooter | 89 | __in BOOL fFooter |
62 | ); | 90 | ); |
63 | 91 | ||
92 | /******************************************************************** | ||
93 | LogIsOpen - returns whether log file is open or note | ||
94 | |||
95 | ********************************************************************/ | ||
64 | BOOL DAPI LogIsOpen(); | 96 | BOOL DAPI LogIsOpen(); |
65 | 97 | ||
98 | /******************************************************************** | ||
99 | LogSetSpecialParams - sets a special beginline string, endline | ||
100 | string, post-timestamp string, etc. | ||
101 | ********************************************************************/ | ||
66 | HRESULT DAPI LogSetSpecialParams( | 102 | HRESULT DAPI LogSetSpecialParams( |
67 | __in_z_opt LPCWSTR wzSpecialBeginLine, | 103 | __in_z_opt LPCWSTR wzSpecialBeginLine, |
68 | __in_z_opt LPCWSTR wzSpecialAfterTimeStamp, | 104 | __in_z_opt LPCWSTR wzSpecialAfterTimeStamp, |
69 | __in_z_opt LPCWSTR wzSpecialEndLine | 105 | __in_z_opt LPCWSTR wzSpecialEndLine |
70 | ); | 106 | ); |
71 | 107 | ||
108 | /******************************************************************** | ||
109 | LogSetLevel - sets the logging level | ||
110 | |||
111 | NOTE: returns previous logging level | ||
112 | ********************************************************************/ | ||
72 | REPORT_LEVEL DAPI LogSetLevel( | 113 | REPORT_LEVEL DAPI LogSetLevel( |
73 | __in REPORT_LEVEL rl, | 114 | __in REPORT_LEVEL rl, |
74 | __in BOOL fLogChange | 115 | __in BOOL fLogChange |
75 | ); | 116 | ); |
76 | 117 | ||
118 | /******************************************************************** | ||
119 | LogGetLevel - gets the current logging level | ||
120 | |||
121 | ********************************************************************/ | ||
77 | REPORT_LEVEL DAPI LogGetLevel(); | 122 | REPORT_LEVEL DAPI LogGetLevel(); |
78 | 123 | ||
124 | /******************************************************************** | ||
125 | LogGetPath - gets the current log path | ||
126 | |||
127 | ********************************************************************/ | ||
79 | HRESULT DAPI LogGetPath( | 128 | HRESULT DAPI LogGetPath( |
80 | __out_ecount_z(cchLogPath) LPWSTR pwzLogPath, | 129 | __out_ecount_z(cchLogPath) LPWSTR pwzLogPath, |
81 | __in DWORD cchLogPath | 130 | __in DWORD cchLogPath |
82 | ); | 131 | ); |
83 | 132 | ||
133 | /******************************************************************** | ||
134 | LogGetHandle - gets the current log file handle | ||
135 | |||
136 | ********************************************************************/ | ||
84 | HANDLE DAPI LogGetHandle(); | 137 | HANDLE DAPI LogGetHandle(); |
85 | 138 | ||
86 | HRESULT DAPIV LogString( | 139 | /******************************************************************** |
87 | __in REPORT_LEVEL rl, | 140 | LogStringArgs - implementation of LogString |
88 | __in_z __format_string LPCSTR szFormat, | ||
89 | ... | ||
90 | ); | ||
91 | 141 | ||
142 | ********************************************************************/ | ||
92 | HRESULT DAPI LogStringArgs( | 143 | HRESULT DAPI LogStringArgs( |
93 | __in REPORT_LEVEL rl, | 144 | __in REPORT_LEVEL rl, |
94 | __in_z __format_string LPCSTR szFormat, | 145 | __in_z __format_string LPCSTR szFormat, |
95 | __in va_list args | 146 | __in va_list args |
96 | ); | 147 | ); |
97 | 148 | ||
98 | HRESULT DAPIV LogStringLine( | 149 | /******************************************************************** |
150 | LogString - write a string to the log | ||
151 | |||
152 | NOTE: use printf formatting ("%ls", "%d", etc.) | ||
153 | ********************************************************************/ | ||
154 | inline HRESULT LogString( | ||
99 | __in REPORT_LEVEL rl, | 155 | __in REPORT_LEVEL rl, |
100 | __in_z __format_string LPCSTR szFormat, | 156 | __in_z __format_string LPCSTR szFormat, |
101 | ... | 157 | ... |
102 | ); | 158 | ) |
159 | { | ||
160 | HRESULT hr = S_OK; | ||
161 | va_list args; | ||
162 | |||
163 | va_start(args, szFormat); | ||
164 | hr = LogStringArgs(rl, szFormat, args); | ||
165 | va_end(args); | ||
103 | 166 | ||
167 | return hr; | ||
168 | } | ||
169 | |||
170 | /******************************************************************** | ||
171 | LogStringLineArgs - implementation of LogStringLine | ||
172 | |||
173 | ********************************************************************/ | ||
104 | HRESULT DAPI LogStringLineArgs( | 174 | HRESULT DAPI LogStringLineArgs( |
105 | __in REPORT_LEVEL rl, | 175 | __in REPORT_LEVEL rl, |
106 | __in_z __format_string LPCSTR szFormat, | 176 | __in_z __format_string LPCSTR szFormat, |
107 | __in va_list args | 177 | __in va_list args |
108 | ); | 178 | ); |
109 | 179 | ||
180 | /******************************************************************** | ||
181 | LogStringLine - write a string plus LOGUTIL_NEWLINE to the log | ||
182 | |||
183 | NOTE: use printf formatting ("%ls", "%d", etc.) | ||
184 | ********************************************************************/ | ||
185 | inline HRESULT LogStringLine( | ||
186 | __in REPORT_LEVEL rl, | ||
187 | __in_z __format_string LPCSTR szFormat, | ||
188 | ... | ||
189 | ) | ||
190 | { | ||
191 | HRESULT hr = S_OK; | ||
192 | va_list args; | ||
193 | |||
194 | va_start(args, szFormat); | ||
195 | hr = LogStringLineArgs(rl, szFormat, args); | ||
196 | va_end(args); | ||
197 | |||
198 | return hr; | ||
199 | } | ||
200 | |||
201 | /******************************************************************** | ||
202 | LogIdModuleArgs - implementation of LogIdModule | ||
203 | |||
204 | ********************************************************************/ | ||
110 | HRESULT DAPI LogIdModuleArgs( | 205 | HRESULT DAPI LogIdModuleArgs( |
111 | __in REPORT_LEVEL rl, | 206 | __in REPORT_LEVEL rl, |
112 | __in DWORD dwLogId, | 207 | __in DWORD dwLogId, |
@@ -114,31 +209,32 @@ HRESULT DAPI LogIdModuleArgs( | |||
114 | __in va_list args | 209 | __in va_list args |
115 | ); | 210 | ); |
116 | 211 | ||
117 | /* | 212 | /******************************************************************** |
118 | * Wraps LogIdModuleArgs, so inline to save the function call | 213 | LogIdModule - write a string embedded in a MESSAGETABLE in the specified module to the log |
119 | */ | ||
120 | 214 | ||
121 | inline HRESULT LogId( | 215 | NOTE: uses format string from MESSAGETABLE resource |
216 | ********************************************************************/ | ||
217 | inline HRESULT LogIdModule( | ||
122 | __in REPORT_LEVEL rl, | 218 | __in REPORT_LEVEL rl, |
123 | __in DWORD dwLogId, | 219 | __in DWORD dwLogId, |
220 | __in_opt HMODULE hModule, | ||
124 | ... | 221 | ... |
125 | ) | 222 | ) |
126 | { | 223 | { |
127 | HRESULT hr = S_OK; | 224 | HRESULT hr = S_OK; |
128 | va_list args; | 225 | va_list args; |
129 | 226 | ||
130 | va_start(args, dwLogId); | 227 | va_start(args, hModule); |
131 | hr = LogIdModuleArgs(rl, dwLogId, NULL, args); | 228 | hr = LogIdModuleArgs(rl, dwLogId, hModule, args); |
132 | va_end(args); | 229 | va_end(args); |
133 | 230 | ||
134 | return hr; | 231 | return hr; |
135 | } | 232 | } |
136 | 233 | ||
234 | /******************************************************************** | ||
235 | LogIdArgs - inline wrapper for LogIdModuleArgs, passing NULL for hModule | ||
137 | 236 | ||
138 | /* | 237 | ********************************************************************/ |
139 | * Wraps LogIdModuleArgs, so inline to save the function call | ||
140 | */ | ||
141 | |||
142 | inline HRESULT LogIdArgs( | 238 | inline HRESULT LogIdArgs( |
143 | __in REPORT_LEVEL rl, | 239 | __in REPORT_LEVEL rl, |
144 | __in DWORD dwLogId, | 240 | __in DWORD dwLogId, |
@@ -148,18 +244,64 @@ inline HRESULT LogIdArgs( | |||
148 | return LogIdModuleArgs(rl, dwLogId, NULL, args); | 244 | return LogIdModuleArgs(rl, dwLogId, NULL, args); |
149 | } | 245 | } |
150 | 246 | ||
151 | HRESULT DAPIV LogErrorString( | 247 | /******************************************************************** |
152 | __in HRESULT hrError, | 248 | LogId - write a string embedded in a MESSAGETABLE in the default module to the log |
153 | __in_z __format_string LPCSTR szFormat, | 249 | |
250 | NOTE: uses format string from MESSAGETABLE resource | ||
251 | ********************************************************************/ | ||
252 | inline HRESULT LogId( | ||
253 | __in REPORT_LEVEL rl, | ||
254 | __in DWORD dwLogId, | ||
154 | ... | 255 | ... |
155 | ); | 256 | ) |
257 | { | ||
258 | HRESULT hr = S_OK; | ||
259 | va_list args; | ||
260 | |||
261 | va_start(args, dwLogId); | ||
262 | hr = LogIdArgs(rl, dwLogId, args); | ||
263 | va_end(args); | ||
264 | |||
265 | return hr; | ||
266 | } | ||
156 | 267 | ||
268 | /******************************************************************** | ||
269 | LogErrorStringArgs - implementation of LogErrorString | ||
270 | |||
271 | ********************************************************************/ | ||
157 | HRESULT DAPI LogErrorStringArgs( | 272 | HRESULT DAPI LogErrorStringArgs( |
158 | __in HRESULT hrError, | 273 | __in HRESULT hrError, |
159 | __in_z __format_string LPCSTR szFormat, | 274 | __in_z __format_string LPCSTR szFormat, |
160 | __in va_list args | 275 | __in va_list args |
161 | ); | 276 | ); |
162 | 277 | ||
278 | /******************************************************************** | ||
279 | LogErrorString - write an error to the log | ||
280 | |||
281 | NOTE: use printf formatting ("%ls", "%d", etc.) | ||
282 | ********************************************************************/ | ||
283 | inline HRESULT LogErrorString( | ||
284 | __in HRESULT hrError, | ||
285 | __in_z __format_string LPCSTR szFormat, | ||
286 | ... | ||
287 | ) | ||
288 | { | ||
289 | HRESULT hr = S_OK; | ||
290 | |||
291 | va_list args; | ||
292 | va_start(args, szFormat); | ||
293 | hr = LogErrorStringArgs(hrError, szFormat, args); | ||
294 | va_end(args); | ||
295 | |||
296 | return hr; | ||
297 | } | ||
298 | |||
299 | /******************************************************************** | ||
300 | LogErrorIdModule - write an error string embedded in the specified module in a MESSAGETABLE to the log | ||
301 | |||
302 | NOTE: uses format string from MESSAGETABLE resource | ||
303 | can log no more than three strings in the error message | ||
304 | ********************************************************************/ | ||
163 | HRESULT DAPI LogErrorIdModule( | 305 | HRESULT DAPI LogErrorIdModule( |
164 | __in HRESULT hrError, | 306 | __in HRESULT hrError, |
165 | __in DWORD dwLogId, | 307 | __in DWORD dwLogId, |
@@ -169,6 +311,12 @@ HRESULT DAPI LogErrorIdModule( | |||
169 | __in_z_opt LPCWSTR wzString3 | 311 | __in_z_opt LPCWSTR wzString3 |
170 | ); | 312 | ); |
171 | 313 | ||
314 | /******************************************************************** | ||
315 | LogErrorId - write an error string embedded in the default module in a MESSAGETABLE to the log | ||
316 | |||
317 | NOTE: uses format string from MESSAGETABLE resource | ||
318 | can log no more than three strings in the error message | ||
319 | ********************************************************************/ | ||
172 | inline HRESULT LogErrorId( | 320 | inline HRESULT LogErrorId( |
173 | __in HRESULT hrError, | 321 | __in HRESULT hrError, |
174 | __in DWORD dwLogId, | 322 | __in DWORD dwLogId, |
@@ -180,10 +328,22 @@ inline HRESULT LogErrorId( | |||
180 | return LogErrorIdModule(hrError, dwLogId, NULL, wzString1, wzString2, wzString3); | 328 | return LogErrorIdModule(hrError, dwLogId, NULL, wzString1, wzString2, wzString3); |
181 | } | 329 | } |
182 | 330 | ||
331 | /******************************************************************** | ||
332 | LogHeader - write a standard header to the log | ||
333 | |||
334 | ********************************************************************/ | ||
183 | HRESULT DAPI LogHeader(); | 335 | HRESULT DAPI LogHeader(); |
184 | 336 | ||
337 | /******************************************************************** | ||
338 | LogFooter - write a standard footer to the log | ||
339 | |||
340 | ********************************************************************/ | ||
185 | HRESULT DAPI LogFooter(); | 341 | HRESULT DAPI LogFooter(); |
186 | 342 | ||
343 | /******************************************************************** | ||
344 | LogStringWorkRaw - Write a raw, unformatted string to the log | ||
345 | |||
346 | ********************************************************************/ | ||
187 | HRESULT LogStringWorkRaw( | 347 | HRESULT LogStringWorkRaw( |
188 | __in_z LPCSTR szLogData | 348 | __in_z LPCSTR szLogData |
189 | ); | 349 | ); |
diff --git a/src/libs/dutil/WixToolset.DUtil/logutil.cpp b/src/libs/dutil/WixToolset.DUtil/logutil.cpp index 1453d1d2..606279c7 100644 --- a/src/libs/dutil/WixToolset.DUtil/logutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/logutil.cpp | |||
@@ -65,27 +65,17 @@ static PFN_LOGSTRINGWORKRAW s_vpfLogStringWorkRaw = NULL; | |||
65 | static LPVOID s_vpvLogStringWorkRawContext = NULL; | 65 | static LPVOID s_vpvLogStringWorkRawContext = NULL; |
66 | 66 | ||
67 | 67 | ||
68 | /******************************************************************** | ||
69 | IsLogInitialized - Checks if log is currently initialized. | ||
70 | ********************************************************************/ | ||
71 | extern "C" BOOL DAPI IsLogInitialized() | 68 | extern "C" BOOL DAPI IsLogInitialized() |
72 | { | 69 | { |
73 | return LogUtil_fInitializedCriticalSection; | 70 | return LogUtil_fInitializedCriticalSection; |
74 | } | 71 | } |
75 | 72 | ||
76 | /******************************************************************** | ||
77 | IsLogOpen - Checks if log is currently initialized and open. | ||
78 | ********************************************************************/ | ||
79 | extern "C" BOOL DAPI IsLogOpen() | 73 | extern "C" BOOL DAPI IsLogOpen() |
80 | { | 74 | { |
81 | return (INVALID_HANDLE_VALUE != LogUtil_hLog && NULL != LogUtil_sczLogPath); | 75 | return (INVALID_HANDLE_VALUE != LogUtil_hLog && NULL != LogUtil_sczLogPath); |
82 | } | 76 | } |
83 | 77 | ||
84 | 78 | ||
85 | /******************************************************************** | ||
86 | LogInitialize - initializes the logutil API | ||
87 | |||
88 | ********************************************************************/ | ||
89 | extern "C" void DAPI LogInitialize( | 79 | extern "C" void DAPI LogInitialize( |
90 | __in_opt HMODULE hModule | 80 | __in_opt HMODULE hModule |
91 | ) | 81 | ) |
@@ -100,11 +90,6 @@ extern "C" void DAPI LogInitialize( | |||
100 | } | 90 | } |
101 | 91 | ||
102 | 92 | ||
103 | /******************************************************************** | ||
104 | LogOpen - creates an application log file | ||
105 | |||
106 | NOTE: if wzExt is null then wzLog is path to desired log else wzLog and wzExt are used to generate log name | ||
107 | ********************************************************************/ | ||
108 | extern "C" HRESULT DAPI LogOpen( | 93 | extern "C" HRESULT DAPI LogOpen( |
109 | __in_z_opt LPCWSTR wzDirectory, | 94 | __in_z_opt LPCWSTR wzDirectory, |
110 | __in_z LPCWSTR wzLog, | 95 | __in_z LPCWSTR wzLog, |
@@ -195,10 +180,6 @@ LExit: | |||
195 | } | 180 | } |
196 | 181 | ||
197 | 182 | ||
198 | /******************************************************************** | ||
199 | LogDisable - closes any open files and disables in memory logging. | ||
200 | |||
201 | ********************************************************************/ | ||
202 | void DAPI LogDisable() | 183 | void DAPI LogDisable() |
203 | { | 184 | { |
204 | ::EnterCriticalSection(&LogUtil_csLog); | 185 | ::EnterCriticalSection(&LogUtil_csLog); |
@@ -213,10 +194,6 @@ void DAPI LogDisable() | |||
213 | } | 194 | } |
214 | 195 | ||
215 | 196 | ||
216 | /******************************************************************** | ||
217 | LogRedirect - Redirects all logging strings to the specified | ||
218 | function - or set NULL to disable the hook | ||
219 | ********************************************************************/ | ||
220 | void DAPI LogRedirect( | 197 | void DAPI LogRedirect( |
221 | __in_opt PFN_LOGSTRINGWORKRAW vpfLogStringWorkRaw, | 198 | __in_opt PFN_LOGSTRINGWORKRAW vpfLogStringWorkRaw, |
222 | __in_opt LPVOID pvContext | 199 | __in_opt LPVOID pvContext |
@@ -231,11 +208,6 @@ void DAPI LogRedirect( | |||
231 | } | 208 | } |
232 | 209 | ||
233 | 210 | ||
234 | /******************************************************************** | ||
235 | LogRename - Renames a logfile, moving its contents to a new path, | ||
236 | and re-opening the file for appending at the new | ||
237 | location | ||
238 | ********************************************************************/ | ||
239 | HRESULT DAPI LogRename( | 211 | HRESULT DAPI LogRename( |
240 | __in_z LPCWSTR wzNewPath | 212 | __in_z LPCWSTR wzNewPath |
241 | ) | 213 | ) |
@@ -309,20 +281,12 @@ extern "C" void DAPI LogUninitialize( | |||
309 | } | 281 | } |
310 | 282 | ||
311 | 283 | ||
312 | /******************************************************************** | ||
313 | LogIsOpen - returns whether log file is open or note | ||
314 | |||
315 | ********************************************************************/ | ||
316 | extern "C" BOOL DAPI LogIsOpen() | 284 | extern "C" BOOL DAPI LogIsOpen() |
317 | { | 285 | { |
318 | return INVALID_HANDLE_VALUE != LogUtil_hLog; | 286 | return INVALID_HANDLE_VALUE != LogUtil_hLog; |
319 | } | 287 | } |
320 | 288 | ||
321 | 289 | ||
322 | /******************************************************************** | ||
323 | LogSetSpecialParams - sets a special beginline string, endline | ||
324 | string, post-timestamp string, etc. | ||
325 | ********************************************************************/ | ||
326 | HRESULT DAPI LogSetSpecialParams( | 290 | HRESULT DAPI LogSetSpecialParams( |
327 | __in_z_opt LPCWSTR wzSpecialBeginLine, | 291 | __in_z_opt LPCWSTR wzSpecialBeginLine, |
328 | __in_z_opt LPCWSTR wzSpecialAfterTimeStamp, | 292 | __in_z_opt LPCWSTR wzSpecialAfterTimeStamp, |
@@ -368,11 +332,6 @@ LExit: | |||
368 | return hr; | 332 | return hr; |
369 | } | 333 | } |
370 | 334 | ||
371 | /******************************************************************** | ||
372 | LogSetLevel - sets the logging level | ||
373 | |||
374 | NOTE: returns previous logging level | ||
375 | ********************************************************************/ | ||
376 | extern "C" REPORT_LEVEL DAPI LogSetLevel( | 335 | extern "C" REPORT_LEVEL DAPI LogSetLevel( |
377 | __in REPORT_LEVEL rl, | 336 | __in REPORT_LEVEL rl, |
378 | __in BOOL fLogChange | 337 | __in BOOL fLogChange |
@@ -416,20 +375,12 @@ extern "C" REPORT_LEVEL DAPI LogSetLevel( | |||
416 | } | 375 | } |
417 | 376 | ||
418 | 377 | ||
419 | /******************************************************************** | ||
420 | LogGetLevel - gets the current logging level | ||
421 | |||
422 | ********************************************************************/ | ||
423 | extern "C" REPORT_LEVEL DAPI LogGetLevel() | 378 | extern "C" REPORT_LEVEL DAPI LogGetLevel() |
424 | { | 379 | { |
425 | return LogUtil_rlCurrent; | 380 | return LogUtil_rlCurrent; |
426 | } | 381 | } |
427 | 382 | ||
428 | 383 | ||
429 | /******************************************************************** | ||
430 | LogGetPath - gets the current log path | ||
431 | |||
432 | ********************************************************************/ | ||
433 | extern "C" HRESULT DAPI LogGetPath( | 384 | extern "C" HRESULT DAPI LogGetPath( |
434 | __out_ecount_z(cchLogPath) LPWSTR pwzLogPath, | 385 | __out_ecount_z(cchLogPath) LPWSTR pwzLogPath, |
435 | __in DWORD cchLogPath | 386 | __in DWORD cchLogPath |
@@ -451,37 +402,12 @@ LExit: | |||
451 | } | 402 | } |
452 | 403 | ||
453 | 404 | ||
454 | /******************************************************************** | ||
455 | LogGetHandle - gets the current log file handle | ||
456 | |||
457 | ********************************************************************/ | ||
458 | extern "C" HANDLE DAPI LogGetHandle() | 405 | extern "C" HANDLE DAPI LogGetHandle() |
459 | { | 406 | { |
460 | return LogUtil_hLog; | 407 | return LogUtil_hLog; |
461 | } | 408 | } |
462 | 409 | ||
463 | 410 | ||
464 | /******************************************************************** | ||
465 | LogString - write a string to the log | ||
466 | |||
467 | NOTE: use printf formatting ("%ls", "%d", etc.) | ||
468 | ********************************************************************/ | ||
469 | extern "C" HRESULT DAPIV LogString( | ||
470 | __in REPORT_LEVEL rl, | ||
471 | __in_z __format_string LPCSTR szFormat, | ||
472 | ... | ||
473 | ) | ||
474 | { | ||
475 | HRESULT hr = S_OK; | ||
476 | va_list args; | ||
477 | |||
478 | va_start(args, szFormat); | ||
479 | hr = LogStringArgs(rl, szFormat, args); | ||
480 | va_end(args); | ||
481 | |||
482 | return hr; | ||
483 | } | ||
484 | |||
485 | extern "C" HRESULT DAPI LogStringArgs( | 411 | extern "C" HRESULT DAPI LogStringArgs( |
486 | __in REPORT_LEVEL rl, | 412 | __in REPORT_LEVEL rl, |
487 | __in_z __format_string LPCSTR szFormat, | 413 | __in_z __format_string LPCSTR szFormat, |
@@ -502,27 +428,6 @@ LExit: | |||
502 | return hr; | 428 | return hr; |
503 | } | 429 | } |
504 | 430 | ||
505 | /******************************************************************** | ||
506 | LogStringLine - write a string plus LOGUTIL_NEWLINE to the log | ||
507 | |||
508 | NOTE: use printf formatting ("%ls", "%d", etc.) | ||
509 | ********************************************************************/ | ||
510 | extern "C" HRESULT DAPIV LogStringLine( | ||
511 | __in REPORT_LEVEL rl, | ||
512 | __in_z __format_string LPCSTR szFormat, | ||
513 | ... | ||
514 | ) | ||
515 | { | ||
516 | HRESULT hr = S_OK; | ||
517 | va_list args; | ||
518 | |||
519 | va_start(args, szFormat); | ||
520 | hr = LogStringLineArgs(rl, szFormat, args); | ||
521 | va_end(args); | ||
522 | |||
523 | return hr; | ||
524 | } | ||
525 | |||
526 | extern "C" HRESULT DAPI LogStringLineArgs( | 431 | extern "C" HRESULT DAPI LogStringLineArgs( |
527 | __in REPORT_LEVEL rl, | 432 | __in REPORT_LEVEL rl, |
528 | __in_z __format_string LPCSTR szFormat, | 433 | __in_z __format_string LPCSTR szFormat, |
@@ -543,11 +448,6 @@ LExit: | |||
543 | return hr; | 448 | return hr; |
544 | } | 449 | } |
545 | 450 | ||
546 | /******************************************************************** | ||
547 | LogIdModuleArgs - write a string embedded in a MESSAGETABLE to the log | ||
548 | |||
549 | NOTE: uses format string from MESSAGETABLE resource | ||
550 | ********************************************************************/ | ||
551 | 451 | ||
552 | extern "C" HRESULT DAPI LogIdModuleArgs( | 452 | extern "C" HRESULT DAPI LogIdModuleArgs( |
553 | __in REPORT_LEVEL rl, | 453 | __in REPORT_LEVEL rl, |
@@ -570,53 +470,6 @@ LExit: | |||
570 | return hr; | 470 | return hr; |
571 | } | 471 | } |
572 | 472 | ||
573 | extern "C" HRESULT DAPI LogIdModule( | ||
574 | __in REPORT_LEVEL rl, | ||
575 | __in DWORD dwLogId, | ||
576 | __in_opt HMODULE hModule, | ||
577 | ... | ||
578 | ) | ||
579 | { | ||
580 | AssertSz(REPORT_NONE != rl, "REPORT_NONE is not a valid logging level"); | ||
581 | HRESULT hr = S_OK; | ||
582 | va_list args; | ||
583 | |||
584 | if (REPORT_ERROR != rl && LogUtil_rlCurrent < rl) | ||
585 | { | ||
586 | ExitFunction1(hr = S_FALSE); | ||
587 | } | ||
588 | |||
589 | va_start(args, hModule); | ||
590 | hr = LogIdWork(rl, (hModule) ? hModule : LogUtil_hModule, dwLogId, args, TRUE); | ||
591 | va_end(args); | ||
592 | |||
593 | LExit: | ||
594 | return hr; | ||
595 | } | ||
596 | |||
597 | |||
598 | |||
599 | |||
600 | /******************************************************************** | ||
601 | LogError - write an error to the log | ||
602 | |||
603 | NOTE: use printf formatting ("%ls", "%d", etc.) | ||
604 | ********************************************************************/ | ||
605 | extern "C" HRESULT DAPIV LogErrorString( | ||
606 | __in HRESULT hrError, | ||
607 | __in_z __format_string LPCSTR szFormat, | ||
608 | ... | ||
609 | ) | ||
610 | { | ||
611 | HRESULT hr = S_OK; | ||
612 | |||
613 | va_list args; | ||
614 | va_start(args, szFormat); | ||
615 | hr = LogErrorStringArgs(hrError, szFormat, args); | ||
616 | va_end(args); | ||
617 | |||
618 | return hr; | ||
619 | } | ||
620 | 473 | ||
621 | extern "C" HRESULT DAPI LogErrorStringArgs( | 474 | extern "C" HRESULT DAPI LogErrorStringArgs( |
622 | __in HRESULT hrError, | 475 | __in HRESULT hrError, |
@@ -648,12 +501,6 @@ LExit: | |||
648 | } | 501 | } |
649 | 502 | ||
650 | 503 | ||
651 | /******************************************************************** | ||
652 | LogErrorIdModule - write an error string embedded in a MESSAGETABLE to the log | ||
653 | |||
654 | NOTE: uses format string from MESSAGETABLE resource | ||
655 | can log no more than three strings in the error message | ||
656 | ********************************************************************/ | ||
657 | extern "C" HRESULT DAPI LogErrorIdModule( | 504 | extern "C" HRESULT DAPI LogErrorIdModule( |
658 | __in HRESULT hrError, | 505 | __in HRESULT hrError, |
659 | __in DWORD dwLogId, | 506 | __in DWORD dwLogId, |
@@ -681,10 +528,6 @@ LExit: | |||
681 | return hr; | 528 | return hr; |
682 | } | 529 | } |
683 | 530 | ||
684 | /******************************************************************** | ||
685 | LogHeader - write a standard header to the log | ||
686 | |||
687 | ********************************************************************/ | ||
688 | extern "C" HRESULT DAPI LogHeader() | 531 | extern "C" HRESULT DAPI LogHeader() |
689 | { | 532 | { |
690 | HRESULT hr = S_OK; | 533 | HRESULT hr = S_OK; |
@@ -761,10 +604,6 @@ extern "C" HRESULT DAPI LogHeader() | |||
761 | } | 604 | } |
762 | 605 | ||
763 | 606 | ||
764 | /******************************************************************** | ||
765 | LogFooterWork - write a standard footer to the log | ||
766 | |||
767 | ********************************************************************/ | ||
768 | 607 | ||
769 | static HRESULT LogFooterWork( | 608 | static HRESULT LogFooterWork( |
770 | __in_z __format_string LPCSTR szFormat, | 609 | __in_z __format_string LPCSTR szFormat, |
@@ -791,10 +630,6 @@ extern "C" HRESULT DAPI LogFooter() | |||
791 | return hr; | 630 | return hr; |
792 | } | 631 | } |
793 | 632 | ||
794 | /******************************************************************** | ||
795 | LogStringWorkRaw - Write a raw, unformatted string to the log | ||
796 | |||
797 | ********************************************************************/ | ||
798 | extern "C" HRESULT LogStringWorkRaw( | 633 | extern "C" HRESULT LogStringWorkRaw( |
799 | __in_z LPCSTR szLogData | 634 | __in_z LPCSTR szLogData |
800 | ) | 635 | ) |