This source file includes following definitions.
- sir_makeinit
- sir_init
- sir_cleanup
- sir_isinitialized
- sir_geterror
- sir_geterrorinfo
- PRINTF_FORMAT_ATTR
- PRINTF_FORMAT_ATTR
- PRINTF_FORMAT_ATTR
- PRINTF_FORMAT_ATTR
- PRINTF_FORMAT_ATTR
- PRINTF_FORMAT_ATTR
- PRINTF_FORMAT_ATTR
- PRINTF_FORMAT_ATTR
- sir_addfile
- sir_remfile
- sir_loadplugin
- sir_unloadplugin
- sir_filelevels
- sir_fileopts
- sir_settextstyle
- sir_resettextstyles
- sir_makergb
- sir_setcolormode
- sir_stdoutlevels
- sir_stdoutopts
- sir_stderrlevels
- sir_stderropts
- sir_sysloglevels
- sir_syslogopts
- sir_syslogid
- sir_syslogcat
- sir_getversionstring
- sir_getversionhex
- sir_isprerelease
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 #include "sir.h"
38 #include "sir/internal.h"
39 #include "sir/filecache.h"
40 #include "sir/plugins.h"
41 #include "sir/textstyle.h"
42 #include "sir/defaults.h"
43
44 bool sir_makeinit(sirinit* si) {
45 return _sir_makeinit(si);
46 }
47
48 bool sir_init(sirinit* si) {
49 return _sir_init(si);
50 }
51
52 bool sir_cleanup(void) {
53 return _sir_cleanup();
54 }
55
56 bool sir_isinitialized(void) {
57 return _sir_isinitialized();
58 }
59
60 uint16_t sir_geterror(char message[SIR_MAXERROR]) {
61 return _sir_geterrcode(_sir_geterror(message));
62 }
63
64 void sir_geterrorinfo(sir_errorinfo* err) {
65 _sir_geterrorinfo(err);
66 }
67
68 PRINTF_FORMAT_ATTR(1, 2)
69 bool sir_debug(PRINTF_FORMAT const char* format, ...) {
70 _SIR_L_START(format);
71 ret = _sir_logv(SIRL_DEBUG, format, args);
72 _SIR_L_END();
73 return ret;
74 }
75
76 PRINTF_FORMAT_ATTR(1, 2)
77 bool sir_info(PRINTF_FORMAT const char* format, ...) {
78 _SIR_L_START(format);
79 ret = _sir_logv(SIRL_INFO, format, args);
80 _SIR_L_END();
81 return ret;
82 }
83
84 PRINTF_FORMAT_ATTR(1, 2)
85 bool sir_notice(PRINTF_FORMAT const char* format, ...) {
86 _SIR_L_START(format);
87 ret = _sir_logv(SIRL_NOTICE, format, args);
88 _SIR_L_END();
89 return ret;
90 }
91
92 PRINTF_FORMAT_ATTR(1, 2)
93 bool sir_warn(PRINTF_FORMAT const char* format, ...) {
94 _SIR_L_START(format);
95 ret = _sir_logv(SIRL_WARN, format, args);
96 _SIR_L_END();
97 return ret;
98 }
99
100 PRINTF_FORMAT_ATTR(1, 2)
101 bool sir_error(PRINTF_FORMAT const char* format, ...) {
102 _SIR_L_START(format);
103 ret = _sir_logv(SIRL_ERROR, format, args);
104 _SIR_L_END();
105 return ret;
106 }
107
108 PRINTF_FORMAT_ATTR(1, 2)
109 bool sir_crit(PRINTF_FORMAT const char* format, ...) {
110 _SIR_L_START(format);
111 ret = _sir_logv(SIRL_CRIT, format, args);
112 _SIR_L_END();
113 return ret;
114 }
115
116 PRINTF_FORMAT_ATTR(1, 2)
117 bool sir_alert(PRINTF_FORMAT const char* format, ...) {
118 _SIR_L_START(format);
119 ret = _sir_logv(SIRL_ALERT, format, args);
120 _SIR_L_END();
121 return ret;
122 }
123
124 PRINTF_FORMAT_ATTR(1, 2)
125 bool sir_emerg(PRINTF_FORMAT const char* format, ...) {
126 _SIR_L_START(format);
127 ret = _sir_logv(SIRL_EMERG, format, args);
128 _SIR_L_END();
129 return ret;
130 }
131
132 sirfileid sir_addfile(const char* path, sir_levels levels, sir_options opts) {
133 return _sir_addfile(path, levels, opts);
134 }
135
136 bool sir_remfile(sirfileid id) {
137 return _sir_remfile(id);
138 }
139
140 sirpluginid sir_loadplugin(const char* path) {
141 #if !defined(SIR_NO_PLUGINS)
142 return _sir_plugin_load(path);
143 #else
144 SIR_UNUSED(path);
145 return _sir_seterror(_SIR_E_UNAVAIL);
146 #endif
147 }
148
149 bool sir_unloadplugin(sirpluginid id) {
150 #if !defined(SIR_NO_PLUGINS)
151 return _sir_plugin_rem(id);
152 #else
153 SIR_UNUSED(id);
154 return _sir_seterror(_SIR_E_UNAVAIL);
155 #endif
156 }
157
158 bool sir_filelevels(sirfileid id, sir_levels levels) {
159 _sir_defaultlevels(&levels, sir_file_def_lvls);
160 sir_update_config_data data = {SIRU_LEVELS, &levels, NULL, NULL, NULL};
161 return _sir_updatefile(id, &data);
162 }
163
164 bool sir_fileopts(sirfileid id, sir_options opts) {
165 _sir_defaultopts(&opts, sir_file_def_opts);
166 sir_update_config_data data = {SIRU_OPTIONS, NULL, &opts, NULL, NULL};
167 return _sir_updatefile(id, &data);
168 }
169
170 bool sir_settextstyle(sir_level level, sir_textattr attr, sir_textcolor fg,
171 sir_textcolor bg) {
172 sir_textstyle style = {
173 attr,
174 fg,
175 bg
176 };
177
178 return _sir_settextstyle(level, &style);
179 }
180
181 bool sir_resettextstyles(void) {
182 return _sir_resettextstyles();
183 }
184
185 sir_textcolor sir_makergb(sir_textcolor r, sir_textcolor g, sir_textcolor b) {
186 return _sir_makergb(r, g, b);
187 }
188
189 bool sir_setcolormode(sir_colormode mode) {
190 return _sir_setcolormode(mode);
191 }
192
193 bool sir_stdoutlevels(sir_levels levels) {
194 _sir_defaultlevels(&levels, sir_stdout_def_lvls);
195 sir_update_config_data data = {SIRU_LEVELS, &levels, NULL, NULL, NULL};
196 return _sir_writeinit(&data, _sir_stdoutlevels);
197 }
198
199 bool sir_stdoutopts(sir_options opts) {
200 _sir_defaultopts(&opts, sir_stdout_def_opts);
201 sir_update_config_data data = {SIRU_OPTIONS, NULL, &opts, NULL, NULL};
202 return _sir_writeinit(&data, _sir_stdoutopts);
203 }
204
205 bool sir_stderrlevels(sir_levels levels) {
206 _sir_defaultlevels(&levels, sir_stderr_def_lvls);
207 sir_update_config_data data = {SIRU_LEVELS, &levels, NULL, NULL, NULL};
208 return _sir_writeinit(&data, _sir_stderrlevels);
209 }
210
211 bool sir_stderropts(sir_options opts) {
212 _sir_defaultopts(&opts, sir_stderr_def_opts);
213 sir_update_config_data data = {SIRU_OPTIONS, NULL, &opts, NULL, NULL};
214 return _sir_writeinit(&data, _sir_stderropts);
215 }
216
217 bool sir_sysloglevels(sir_levels levels) {
218 #if !defined(SIR_NO_SYSTEM_LOGGERS)
219 _sir_defaultlevels(&levels, sir_syslog_def_lvls);
220 sir_update_config_data data = {SIRU_LEVELS, &levels, NULL, NULL, NULL};
221 return _sir_writeinit(&data, _sir_sysloglevels);
222 #else
223 SIR_UNUSED(levels);
224 return _sir_seterror(_SIR_E_UNAVAIL);
225 #endif
226 }
227
228 bool sir_syslogopts(sir_options opts) {
229 #if !defined(SIR_NO_SYSTEM_LOGGERS)
230 _sir_defaultopts(&opts, sir_syslog_def_opts);
231 sir_update_config_data data = {SIRU_OPTIONS, NULL, &opts, NULL, NULL};
232 return _sir_writeinit(&data, _sir_syslogopts);
233 #else
234 SIR_UNUSED(opts);
235 return _sir_seterror(_SIR_E_UNAVAIL);
236 #endif
237 }
238
239 bool sir_syslogid(const char* identity) {
240 #if !defined(SIR_NO_SYSTEM_LOGGERS)
241 sir_update_config_data data = {SIRU_SYSLOG_ID, NULL, NULL, identity, NULL};
242 return _sir_writeinit(&data, _sir_syslogid);
243 #else
244 SIR_UNUSED(identity);
245 return _sir_seterror(_SIR_E_UNAVAIL);
246 #endif
247 }
248
249 bool sir_syslogcat(const char* category) {
250 #if !defined(SIR_NO_SYSTEM_LOGGERS)
251 sir_update_config_data data = {SIRU_SYSLOG_CAT, NULL, NULL, NULL, category};
252 return _sir_writeinit(&data, _sir_syslogcat);
253 #else
254 SIR_UNUSED(category);
255 return _sir_seterror(_SIR_E_UNAVAIL);
256 #endif
257 }
258
259 const char* sir_getversionstring(void) {
260 return _SIR_MK_VER_STR(SIR_VERSION_MAJOR, SIR_VERSION_MINOR, SIR_VERSION_PATCH);
261 }
262
263 uint32_t sir_getversionhex(void) {
264 return SIR_VERSION_HEX;
265 }
266
267 bool sir_isprerelease(void) {
268 return (!SIR_VERSION_IS_RELEASE);
269 }