Mercurial > trustbridge
annotate common/logging.c @ 615:2a4f7364ab81
Add first simple event logging functions
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 19 Jun 2014 11:53:07 +0200 |
parents | 17e1c8f37d72 |
children | 0172740f5c6e |
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 #include "logging.h" |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 #include "strhelp.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 #include <stdio.h> |
615
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
12 #include <stdarg.h> |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
13 #include <stdbool.h> |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
14 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
15 #include <strhelp.h> |
252
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 #ifdef WIN32 |
615
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
18 # include <windows.h> |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
19 #else |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
20 # include <syslog.h> |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
21 #endif |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
22 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
23 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
24 #ifdef WIN32 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
25 static void |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
26 win_log(const char *format, va_list ap, bool error) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
27 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
28 HANDLE log_src = NULL; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
29 wchar_t *wmsg = NULL; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
30 BOOL failure = TRUE; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
31 WORD type = 0, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
32 category = 0; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
33 char buffer[MAX_LOG+1]; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
34 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
35 vsnprintf (buffer, MAX_LOG, format, ap); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
36 buffer[MAX_LOG] = '\0'; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
37 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
38 log_src = RegisterEventSourceA (NULL, LOG_NAME); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
39 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
40 if (log_src == NULL) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
41 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
42 PRINTLASTERROR ("Failed to open log source."); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
43 return; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
44 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
45 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
46 if (error) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
47 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
48 type = EVENTLOG_ERROR_TYPE; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
49 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
50 else |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
51 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
52 type = EVENTLOG_INFORMATION_TYPE; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
53 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
54 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
55 wmsg = utf8_to_wchar (buffer, strlen(buffer)); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
56 if (wmsg == NULL) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
57 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
58 ERRORPRINTF ("Failed to convert log message to utf-16"); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
59 goto done; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
60 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
61 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
62 failure = ReportEventW (log_src, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
63 type, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
64 category, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
65 0, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
66 NULL, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
67 1, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
68 0, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
69 (const WCHAR **) &wmsg, |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
70 NULL); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
71 if (failure) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
72 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
73 PRINTLASTERROR ("Failed to report event."); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
74 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
75 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
76 done: |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
77 xfree (wmsg); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
78 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
79 if (!DeregisterEventSource (log_src)) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
80 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
81 PRINTLASTERROR ("Failed to close log source."); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
82 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
83 return; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
84 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
85 |
252
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
86 char * |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
87 getLastErrorMsg() |
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 LPWSTR bufPtr = NULL; |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
90 DWORD err = GetLastError(); |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
91 char *retval = NULL; |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
92 FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER | |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
93 FORMAT_MESSAGE_FROM_SYSTEM | |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
94 FORMAT_MESSAGE_IGNORE_INSERTS, |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
95 NULL, err, 0, (LPWSTR) &bufPtr, 0, NULL); |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
96 if (!bufPtr) |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
97 { |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
98 HMODULE hWinhttp = GetModuleHandleW (L"crypt32"); |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
99 if (hWinhttp) |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
100 { |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
101 FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER | |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
102 FORMAT_MESSAGE_FROM_HMODULE | |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
103 FORMAT_MESSAGE_IGNORE_INSERTS, |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
104 hWinhttp, HRESULT_CODE (err), 0, |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
105 (LPWSTR) &bufPtr, 0, NULL); |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
106 } |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
107 } |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
108 if (!bufPtr) { |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
109 fprintf (stderr, "Error getting last error for code: %lx \n", err); |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
110 return NULL; |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
111 } |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
112 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
113 retval = wchar_to_utf8(bufPtr, wcslen(bufPtr)); |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
114 LocalFree (bufPtr); |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
115 |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
116 return retval; |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
117 } |
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
118 |
615
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
119 #else /* WIN32 */ |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
120 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
121 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
122 static void |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
123 linux_log (const char *format, va_list ap, bool error) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
124 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
125 openlog (LOG_NAME, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
126 vsyslog ( error ? LOG_ERR : LOG_INFO, format, ap); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
127 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
128 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
129 #endif /* WIN32 */ |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
130 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
131 void |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
132 syslog_info_printf(const char *format, ...) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
133 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
134 va_list args; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
135 va_start (args, format); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
136 #ifdef WIN32 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
137 win_log (format, args, false); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
138 #else |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
139 linux_log (format, args, false); |
252
bd7fb50078b4
Add logging.h for some logging / debug functions
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
140 #endif |
615
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
141 va_end (args); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
142 } |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
143 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
144 void |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
145 syslog_error_printf(const char *format, ...) |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
146 { |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
147 va_list args; |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
148 va_start (args, format); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
149 #ifdef WIN32 |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
150 win_log (format, args, true); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
151 #else |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
152 linux_log (format, args, true); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
153 #endif |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
154 va_end (args); |
2a4f7364ab81
Add first simple event logging functions
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
155 } |