corosync 3.1.5
logconfig.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2002-2005 MontaVista Software, Inc.
3 * Copyright (c) 2006-2011 Red Hat, Inc.
4 *
5 * All rights reserved.
6 *
7 * Author: Steven Dake (sdake@redhat.com)
8 * Jan Friesse (jfriesse@redhat.com)
9 *
10 * This software licensed under BSD license, the text of which follows:
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * - Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * - Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * - Neither the name of the MontaVista Software, Inc. nor the names of its
21 * contributors may be used to endorse or promote products derived from this
22 * software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34 * THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include "config.h"
38
40#include <corosync/logsys.h>
41#ifdef LOGCONFIG_USE_ICMAP
42#include <corosync/icmap.h>
43#define MAP_KEYNAME_MAXLEN ICMAP_KEYNAME_MAXLEN
44#define map_get_string(key_name, value) icmap_get_string(key_name, value)
45#else
46#include <corosync/cmap.h>
48static const char *main_logfile;
49#define MAP_KEYNAME_MAXLEN CMAP_KEYNAME_MAXLEN
50#define map_get_string(key_name, value) cmap_get_string(cmap_handle, key_name, value)
51#endif
52
53#include "util.h"
54#include "logconfig.h"
55
56static char error_string_response[512];
57
79static int insert_into_buffer(
80 char *target_buffer,
81 size_t bufferlen,
82 const char *entry,
83 const char *after)
84{
85 const char *current_format = NULL;
86
87 current_format = logsys_format_get();
88
89 /* if the entry is already in the format we don't add it again */
90 if (strstr(current_format, entry) != NULL) {
91 return -1;
92 }
93
94 /* if there is no "after", simply prepend the requested entry
95 * otherwise go for beautiful string manipulation.... </sarcasm> */
96 if (!after) {
97 if (snprintf(target_buffer, bufferlen - 1, "%s%s",
98 entry,
99 current_format) >= bufferlen - 1) {
100 return -1;
101 }
102 } else {
103 const char *afterpos;
104 size_t afterlen;
105 size_t templen;
106
107 /* check if after is contained in the format
108 * and afterlen has a meaning or return an error */
109 afterpos = strstr(current_format, after);
110 afterlen = strlen(after);
111 if ((!afterpos) || (!afterlen)) {
112 return -1;
113 }
114
115 templen = afterpos - current_format + afterlen;
116 if (snprintf(target_buffer, templen + 1, "%s", current_format)
117 >= bufferlen - 1) {
118 return -1;
119 }
120 if (snprintf(target_buffer + templen, bufferlen - ( templen + 1 ),
121 "%s%s", entry, current_format + templen)
122 >= bufferlen - ( templen + 1 )) {
123 return -1;
124 }
125 }
126 return 0;
127}
128
129/*
130 * format set is global specific option that
131 * doesn't apply at system/subsystem level.
132 */
133static int corosync_main_config_format_set (
134 const char **error_string)
135{
136 const char *error_reason;
137 char new_format_buffer[PATH_MAX];
138 char *value = NULL;
139 int err = 0;
140 char timestamp_str_to_add[8];
141
142 if (map_get_string("logging.fileline", &value) == CS_OK) {
143 if (strcmp (value, "on") == 0) {
144 if (!insert_into_buffer(new_format_buffer,
145 sizeof(new_format_buffer),
146 " %f:%l", "g]")) {
147 err = logsys_format_set(new_format_buffer);
148 } else
149 if (!insert_into_buffer(new_format_buffer,
150 sizeof(new_format_buffer),
151 "%f:%l", NULL)) {
152 err = logsys_format_set(new_format_buffer);
153 }
154 } else
155 if (strcmp (value, "off") == 0) {
156 /* nothing to do here */
157 } else {
158 error_reason = "unknown value for fileline";
159 free(value);
160 goto parse_error;
161 }
162
163 free(value);
164 }
165
166 if (err) {
167 error_reason = "not enough memory to set logging format buffer";
168 goto parse_error;
169 }
170
171 if (map_get_string("logging.function_name", &value) == CS_OK) {
172 if (strcmp (value, "on") == 0) {
173 if (!insert_into_buffer(new_format_buffer,
174 sizeof(new_format_buffer),
175 "%n:", "f:")) {
176 err = logsys_format_set(new_format_buffer);
177 } else
178 if (!insert_into_buffer(new_format_buffer,
179 sizeof(new_format_buffer),
180 " %n", "g]")) {
181 err = logsys_format_set(new_format_buffer);
182 }
183 } else
184 if (strcmp (value, "off") == 0) {
185 /* nothing to do here */
186 } else {
187 error_reason = "unknown value for function_name";
188 free(value);
189 goto parse_error;
190 }
191
192 free(value);
193 }
194
195 if (err) {
196 error_reason = "not enough memory to set logging format buffer";
197 goto parse_error;
198 }
199
200 memset(timestamp_str_to_add, 0, sizeof(timestamp_str_to_add));
201
202 if (map_get_string("logging.timestamp", &value) == CS_OK) {
203 if (strcmp (value, "on") == 0) {
204 strcpy(timestamp_str_to_add, "%t");
205#ifdef QB_FEATURE_LOG_HIRES_TIMESTAMPS
206 } else if (strcmp (value, "hires") == 0) {
207 strcpy(timestamp_str_to_add, "%T");
208#endif
209 } else if (strcmp (value, "off") == 0) {
210 /* nothing to do here */
211 } else {
212 error_reason = "unknown value for timestamp";
213 free(value);
214 goto parse_error;
215 }
216
217 free(value);
218 } else {
219 /*
220 * Display hires timestamp by default, otherwise standard timestamp
221 */
222#ifdef QB_FEATURE_LOG_HIRES_TIMESTAMPS
223 strcpy(timestamp_str_to_add, "%T");
224#else
225 strcpy(timestamp_str_to_add, "%t");
226#endif
227 }
228
229 if(strcmp(timestamp_str_to_add, "") != 0) {
230 strcat(timestamp_str_to_add, " ");
231 if (insert_into_buffer(new_format_buffer, sizeof(new_format_buffer),
232 timestamp_str_to_add, NULL) == 0) {
233 err = logsys_format_set(new_format_buffer);
234 }
235 }
236
237 if (err) {
238 error_reason = "not enough memory to set logging format buffer";
239 goto parse_error;
240 }
241
242 return (0);
243
244parse_error:
245 *error_string = error_reason;
246
247 return (-1);
248}
249
250/*
251 * blackbox is another global specific option that
252 * doesn't apply at system/subsystem level.
253 */
254static int corosync_main_config_blackbox_set (
255 const char **error_string)
256{
257 const char *error_reason;
258 char *value = NULL;
259
260 if (map_get_string("logging.blackbox", &value) == CS_OK) {
261 if (strcmp (value, "on") == 0) {
262 (void)logsys_blackbox_set(QB_TRUE);
263 } else if (strcmp (value, "off") == 0) {
264 (void)logsys_blackbox_set(QB_FALSE);
265 } else {
266 error_reason = "unknown value for blackbox";
267 free(value);
268 goto parse_error;
269 }
270
271 free(value);
272 } else {
273 (void)logsys_blackbox_set(QB_TRUE);
274 }
275
276 return (0);
277
278parse_error:
279 *error_string = error_reason;
280
281 return (-1);
282}
283
284static int corosync_main_config_log_destination_set (
285 const char *path,
286 const char *key,
287 const char *subsys,
288 const char **error_string,
289 unsigned int mode_mask,
290 char deprecated,
291 char default_value,
292 const char *replacement)
293{
294 static char formatted_error_reason[128];
295 char *value = NULL;
296 unsigned int mode;
297 char key_name[MAP_KEYNAME_MAXLEN];
298
299 snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, key);
300 if (map_get_string(key_name, &value) == CS_OK) {
301 if (deprecated) {
303 "Warning: the %s config parameter has been obsoleted."
304 " See corosync.conf man page %s directive.",
305 key, replacement);
306 }
307
308 mode = logsys_config_mode_get (subsys);
309
310 if (strcmp (value, "yes") == 0 || strcmp (value, "on") == 0) {
311 mode |= mode_mask;
312 if (logsys_config_mode_set(subsys, mode) < 0) {
313 sprintf (formatted_error_reason, "unable to set mode %s", key);
314 goto parse_error;
315 }
316 } else
317 if (strcmp (value, "no") == 0 || strcmp (value, "off") == 0) {
318 mode &= ~mode_mask;
319 if (logsys_config_mode_set(subsys, mode) < 0) {
320 sprintf (formatted_error_reason, "unable to unset mode %s", key);
321 goto parse_error;
322 }
323 } else {
324 sprintf (formatted_error_reason, "unknown value for %s", key);
325 goto parse_error;
326 }
327 }
328 /* Set to default if we are the top-level logger */
329 else if (!subsys && !deprecated) {
330
331 mode = logsys_config_mode_get (subsys);
332 if (default_value) {
333 mode |= mode_mask;
334 }
335 else {
336 mode &= ~mode_mask;
337 }
338 if (logsys_config_mode_set(subsys, mode) < 0) {
339 sprintf (formatted_error_reason, "unable to change mode %s", key);
340 goto parse_error;
341 }
342 }
343
344 free(value);
345 return (0);
346
347parse_error:
348 *error_string = formatted_error_reason;
349 free(value);
350 return (-1);
351}
352
353static int corosync_main_config_set (
354 const char *path,
355 const char *subsys,
356 const char **error_string)
357{
358 const char *error_reason = error_string_response;
359 char *value = NULL;
360 int mode;
361 char key_name[MAP_KEYNAME_MAXLEN];
362
363 /*
364 * this bit abuses the internal logsys exported API
365 * to guarantee that all configured subsystems are
366 * initialized too.
367 *
368 * using this approach avoids some headaches caused
369 * by IPC and TOTEM that have a special logging
370 * handling requirements
371 */
372 if (subsys != NULL) {
373 if (_logsys_subsys_create(subsys, NULL) < 0) {
374 error_reason = "unable to create new logging subsystem";
375 goto parse_error;
376 }
377 }
378
379 mode = logsys_config_mode_get(subsys);
380 if (mode < 0) {
381 error_reason = "unable to get mode";
382 goto parse_error;
383 }
384
385 if (corosync_main_config_log_destination_set (path, "to_stderr", subsys, &error_reason,
386 LOGSYS_MODE_OUTPUT_STDERR, 0, 1, NULL) != 0)
387 goto parse_error;
388
389 if (corosync_main_config_log_destination_set (path, "to_syslog", subsys, &error_reason,
390 LOGSYS_MODE_OUTPUT_SYSLOG, 0, 1, NULL) != 0)
391 goto parse_error;
392
393 snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_facility");
394 if (map_get_string(key_name, &value) == CS_OK) {
395 int syslog_facility;
396
397 syslog_facility = qb_log_facility2int(value);
398 if (syslog_facility < 0) {
399 error_reason = "unknown syslog facility specified";
400 goto parse_error;
401 }
403 syslog_facility) < 0) {
404 error_reason = "unable to set syslog facility";
405 goto parse_error;
406 }
407
408 free(value);
409 }
410 else {
411 /* Set default here in case of a reload */
413 qb_log_facility2int("daemon")) < 0) {
414 error_reason = "unable to set syslog facility";
415 goto parse_error;
416 }
417 }
418
419 snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_level");
420 if (map_get_string(key_name, &value) == CS_OK) {
421 int syslog_priority;
422
424 "Warning: the syslog_level config parameter has been obsoleted."
425 " See corosync.conf man page syslog_priority directive.");
426
427 syslog_priority = logsys_priority_id_get(value);
428 free(value);
429
430 if (syslog_priority < 0) {
431 error_reason = "unknown syslog level specified";
432 goto parse_error;
433 }
435 syslog_priority) < 0) {
436 error_reason = "unable to set syslog level";
437 goto parse_error;
438 }
439 }
440
441 snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_priority");
442 if (map_get_string(key_name, &value) == CS_OK) {
443 int syslog_priority;
444
445 syslog_priority = logsys_priority_id_get(value);
446 free(value);
447 if (syslog_priority < 0) {
448 error_reason = "unknown syslog priority specified";
449 goto parse_error;
450 }
452 syslog_priority) < 0) {
453 error_reason = "unable to set syslog priority";
454 goto parse_error;
455 }
456 }
457 else if(strcmp(key_name, "logging.syslog_priority") == 0){
459 logsys_priority_id_get("info")) < 0) {
460 error_reason = "unable to set syslog level";
461 goto parse_error;
462 }
463 }
464
465#ifdef LOGCONFIG_USE_ICMAP
466 snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile");
467 if (map_get_string(key_name, &value) == CS_OK) {
468 if (logsys_config_file_set (subsys, &error_reason, value) < 0) {
469 goto parse_error;
470 }
471 free(value);
472 }
473#else
474 if (!subsys) {
475 if (logsys_config_file_set (subsys, &error_reason, main_logfile) < 0) {
476 goto parse_error;
477 }
478 }
479#endif
480
481 if (corosync_main_config_log_destination_set (path, "to_file", subsys, &error_reason,
482 LOGSYS_MODE_OUTPUT_FILE, 1, 0, "to_logfile") != 0)
483 goto parse_error;
484
485 if (corosync_main_config_log_destination_set (path, "to_logfile", subsys, &error_reason,
486 LOGSYS_MODE_OUTPUT_FILE, 0, 0, NULL) != 0)
487 goto parse_error;
488
489 snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile_priority");
490 if (map_get_string(key_name, &value) == CS_OK) {
491 int logfile_priority;
492
493 logfile_priority = logsys_priority_id_get(value);
494 free(value);
495 if (logfile_priority < 0) {
496 error_reason = "unknown logfile priority specified";
497 goto parse_error;
498 }
500 logfile_priority) < 0) {
501 error_reason = "unable to set logfile priority";
502 goto parse_error;
503 }
504 }
505 else if(strcmp(key_name,"logging.logfile_priority") == 0){
507 logsys_priority_id_get("info")) < 0) {
508 error_reason = "unable to set syslog level";
509 goto parse_error;
510 }
511 }
512
513 snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "debug");
514 if (map_get_string(key_name, &value) == CS_OK) {
515 if (strcmp (value, "trace") == 0) {
517 error_reason = "unable to set debug trace";
518 free(value);
519 goto parse_error;
520 }
521 } else
522 if (strcmp (value, "on") == 0) {
523 if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_ON) < 0) {
524 error_reason = "unable to set debug on";
525 free(value);
526 goto parse_error;
527 }
528 } else
529 if (strcmp (value, "off") == 0) {
530 if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
531 error_reason = "unable to set debug off";
532 free(value);
533 goto parse_error;
534 }
535 } else {
536 error_reason = "unknown value for debug";
537 free(value);
538 goto parse_error;
539 }
540 free(value);
541 }
542 else {
543 if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
544 error_reason = "unable to set debug off";
545 goto parse_error;
546 }
547 }
548
549 return (0);
550
551parse_error:
552 *error_string = error_reason;
553
554 return (-1);
555}
556
557static int corosync_main_config_read_logging (
558 const char **error_string)
559{
560 const char *error_reason;
561#ifdef LOGCONFIG_USE_ICMAP
562 icmap_iter_t iter;
563 const char *key_name;
564#else
566 char key_name[CMAP_KEYNAME_MAXLEN];
567#endif
568 char key_subsys[MAP_KEYNAME_MAXLEN];
569 char key_item[MAP_KEYNAME_MAXLEN];
570 int res;
571
572 /* format set is supported only for toplevel */
573 if (corosync_main_config_format_set(&error_reason) < 0) {
574 goto parse_error;
575 }
576
577 if (corosync_main_config_blackbox_set(&error_reason) < 0) {
578 goto parse_error;
579 }
580
581 if (corosync_main_config_set ("logging", NULL, &error_reason) < 0) {
582 goto parse_error;
583 }
584
585 /*
586 * we will need 2 of these to compensate for new logging
587 * config format
588 */
589#ifdef LOGCONFIG_USE_ICMAP
590 iter = icmap_iter_init("logging.logger_subsys.");
591 while ((key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) {
592#else
593 cmap_iter_init(cmap_handle, "logging.logger_subsys.", &iter);
594 while ((cmap_iter_next(cmap_handle, iter, key_name, NULL, NULL)) == CS_OK) {
595#endif
596 res = sscanf(key_name, "logging.logger_subsys.%[^.].%s", key_subsys, key_item);
597
598 if (res != 2) {
599 continue ;
600 }
601
602 if (strcmp(key_item, "subsys") != 0) {
603 continue ;
604 }
605
606 if (snprintf(key_item, MAP_KEYNAME_MAXLEN, "logging.logger_subsys.%s",
607 key_subsys) >= MAP_KEYNAME_MAXLEN) {
608 /*
609 * This should never happen
610 */
611 error_reason = "Can't snprintf logger_subsys key_item";
612 goto parse_error;
613 }
614
615 if (corosync_main_config_set(key_item, key_subsys, &error_reason) < 0) {
616 goto parse_error;
617 }
618 }
619#ifdef LOGCONFIG_USE_ICMAP
621#else
623#endif
624
626 return 0;
627
628parse_error:
629 *error_string = error_reason;
630
631 return (-1);
632}
633
634#ifdef LOGCONFIG_USE_ICMAP
635static void main_logging_notify(
636 int32_t event,
637 const char *key_name,
638 struct icmap_notify_value new_val,
639 struct icmap_notify_value old_val,
640 void *user_data)
641#else
642static void main_logging_notify(
643 cmap_handle_t cmap_handle_unused,
644 cmap_handle_t cmap_track_handle_unused,
645 int32_t event,
646 const char *key_name,
647 struct cmap_notify_value new_val,
648 struct cmap_notify_value old_val,
649 void *user_data)
650#endif
651{
652 const char *error_string;
653 static int reload_in_progress = 0;
654
655 /* If a full reload happens then suspend updates for individual keys until
656 * it's all completed
657 */
658 if (strcmp(key_name, "config.reload_in_progress") == 0) {
659 if (*(uint8_t *)new_val.data == 1) {
660 reload_in_progress = 1;
661 } else {
662 reload_in_progress = 0;
663 }
664 }
665 if (reload_in_progress) {
666 log_printf(LOGSYS_LEVEL_DEBUG, "Ignoring key change, reload in progress. %s\n", key_name);
667 return;
668 }
669
670 /*
671 * Reload the logsys configuration
672 */
673 if (logsys_format_set(NULL) == -1) {
674 fprintf (stderr, "Unable to setup logging format.\n");
675 }
676 corosync_main_config_read_logging(&error_string);
677}
678
679#ifdef LOGCONFIG_USE_ICMAP
680static void add_logsys_config_notification(void)
681{
683
684 icmap_track_add("logging.",
686 main_logging_notify,
687 NULL,
688 &icmap_track);
689
690 icmap_track_add("config.reload_in_progress",
692 main_logging_notify,
693 NULL,
694 &icmap_track);
695}
696#else
697static void add_logsys_config_notification(void)
698{
699 cmap_track_handle_t cmap_track;
700
701 cmap_track_add(cmap_handle, "logging.",
703 main_logging_notify,
704 NULL,
705 &cmap_track);
706
707 cmap_track_add(cmap_handle, "config.reload_in_progress",
709 main_logging_notify,
710 NULL,
711 &cmap_track);
712}
713#endif
714
716#ifndef LOGCONFIG_USE_ICMAP
717 cmap_handle_t cmap_h,
718 const char *default_logfile,
719#endif
720 const char **error_string)
721{
722 const char *error_reason = error_string_response;
723
724#ifndef LOGCONFIG_USE_ICMAP
725 if (!cmap_h) {
726 error_reason = "No cmap handle";
727 return (-1);
728 }
729 if (!default_logfile) {
730 error_reason = "No default logfile";
731 return (-1);
732 }
733 cmap_handle = cmap_h;
734 main_logfile = default_logfile;
735#endif
736
737 if (corosync_main_config_read_logging(error_string) < 0) {
738 error_reason = *error_string;
739 goto parse_error;
740 }
741
742 add_logsys_config_notification();
743
744 return 0;
745
746parse_error:
747 snprintf (error_string_response, sizeof(error_string_response),
748 "parse error in config: %s.\n",
749 error_reason);
750
751 *error_string = error_string_response;
752 return (-1);
753}
@ CS_OK
Definition: corotypes.h:99
uint32_t value
uint64_t cmap_iter_handle_t
Definition: cmap.h:59
#define CMAP_KEYNAME_MAXLEN
Definition: cmap.h:69
cs_error_t cmap_iter_next(cmap_handle_t handle, cmap_iter_handle_t iter_handle, char key_name[], size_t *value_len, cmap_value_types_t *type)
Return next item in iterator iter.
Definition: lib/cmap.c:878
cs_error_t cmap_track_add(cmap_handle_t handle, const char *key_name, int32_t track_type, cmap_notify_fn_t notify_fn, void *user_data, cmap_track_handle_t *cmap_track_handle)
Add tracking function for given key_name.
Definition: lib/cmap.c:977
uint64_t cmap_handle_t
Definition: cmap.h:54
uint64_t cmap_track_handle_t
Definition: cmap.h:64
#define CMAP_TRACK_DELETE
Definition: cmap.h:79
#define CMAP_TRACK_ADD
Definition: cmap.h:78
cs_error_t cmap_iter_finalize(cmap_handle_t handle, cmap_iter_handle_t iter_handle)
Finalize iterator.
Definition: lib/cmap.c:938
cs_error_t cmap_iter_init(cmap_handle_t handle, const char *prefix, cmap_iter_handle_t *cmap_iter_handle)
Initialize iterator with given prefix.
Definition: lib/cmap.c:823
#define CMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem....
Definition: cmap.h:87
#define CMAP_TRACK_MODIFY
Definition: cmap.h:80
#define ICMAP_TRACK_MODIFY
Definition: icmap.h:78
#define ICMAP_TRACK_DELETE
Definition: icmap.h:77
cs_error_t icmap_track_add(const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
Add tracking function for given key_name.
Definition: icmap.c:1159
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem....
Definition: icmap.h:85
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
Definition: icmap.c:1089
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
Definition: icmap.c:1095
qb_map_iter_t * icmap_iter_t
Itterator type.
Definition: icmap.h:123
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
Definition: icmap.c:1116
#define ICMAP_TRACK_ADD
Definition: icmap.h:76
#define MAP_KEYNAME_MAXLEN
Definition: logconfig.c:49
#define map_get_string(key_name, value)
Definition: logconfig.c:50
int corosync_log_config_read(cmap_handle_t cmap_h, const char *default_logfile, const char **error_string)
Definition: logconfig.c:715
unsigned int logsys_config_mode_get(const char *subsys)
logsys_config_mode_get
Definition: logsys.c:525
#define log_printf(level, format, args...)
Definition: logsys.h:323
int logsys_config_mode_set(const char *subsys, unsigned int mode)
logsys_config_mode_set
Definition: logsys.c:503
void logsys_blackbox_set(int enable)
Definition: logsys.c:864
char * logsys_format_get(void)
logsys_format_get
Definition: logsys.c:650
#define LOGSYS_DEBUG_OFF
Definition: logsys.h:92
int logsys_config_file_set(const char *subsys, const char **error_string, const char *file)
to close a logfile, just invoke this function with a NULL file or if you want to change logfile,...
Definition: logsys.c:537
#define LOGSYS_MODE_OUTPUT_STDERR
Definition: logsys.h:61
int logsys_config_syslog_priority_set(const char *subsys, unsigned int priority)
logsys_config_syslog_priority_set
Definition: logsys.c:662
#define LOGSYS_DEBUG_TRACE
Definition: logsys.h:94
void logsys_config_apply(void)
logsys_config_apply
Definition: logsys.c:790
int logsys_priority_id_get(const char *name)
logsys_priority_id_get
Definition: logsys.c:830
int logsys_config_logfile_priority_set(const char *subsys, unsigned int priority)
logsys_config_logfile_priority_set
Definition: logsys.c:689
#define LOGSYS_DEBUG_ON
Definition: logsys.h:93
int logsys_config_debug_set(const char *subsys, unsigned int value)
enabling debug, disable message priority filtering.
Definition: logsys.c:804
#define LOGSYS_LEVEL_WARNING
Definition: logsys.h:73
int _logsys_subsys_create(const char *subsys, const char *filename)
_logsys_subsys_create
Definition: logsys.c:433
int logsys_config_syslog_facility_set(const char *subsys, unsigned int facility)
per system/subsystem settings.
Definition: logsys.c:655
#define LOGSYS_LEVEL_DEBUG
Definition: logsys.h:76
#define LOGSYS_MODE_OUTPUT_FILE
Definition: logsys.h:60
#define LOGSYS_MODE_OUTPUT_SYSLOG
Definition: logsys.h:62
int logsys_format_set(const char *format)
configuration bits that can only be done for the whole system
Definition: logsys.c:591
void * user_data
Definition: sam.c:127
cmap_handle_t cmap_handle
Definition: sam.c:137
Structure passed as new_value and old_value in change callback.
Definition: cmap.h:117
const void * data
Definition: cmap.h:120
Structure passed as new_value and old_value in change callback.
Definition: icmap.h:91