corosync  2.4.1
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 
39 #include <corosync/totem/totem.h>
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>
48 static 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 
56 static char error_string_response[512];
57 
79 static 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 the only global specific option that
131  * doesn't apply at system/subsystem level.
132  */
133 static 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 
141  if (map_get_string("logging.fileline", &value) == CS_OK) {
142  if (strcmp (value, "on") == 0) {
143  if (!insert_into_buffer(new_format_buffer,
144  sizeof(new_format_buffer),
145  " %f:%l", "g]")) {
146  err = logsys_format_set(new_format_buffer);
147  } else
148  if (!insert_into_buffer(new_format_buffer,
149  sizeof(new_format_buffer),
150  "%f:%l", NULL)) {
151  err = logsys_format_set(new_format_buffer);
152  }
153  } else
154  if (strcmp (value, "off") == 0) {
155  /* nothing to do here */
156  } else {
157  error_reason = "unknown value for fileline";
158  free(value);
159  goto parse_error;
160  }
161 
162  free(value);
163  }
164 
165  if (err) {
166  error_reason = "not enough memory to set logging format buffer";
167  goto parse_error;
168  }
169 
170  if (map_get_string("logging.function_name", &value) == CS_OK) {
171  if (strcmp (value, "on") == 0) {
172  if (!insert_into_buffer(new_format_buffer,
173  sizeof(new_format_buffer),
174  "%n:", "f:")) {
175  err = logsys_format_set(new_format_buffer);
176  } else
177  if (!insert_into_buffer(new_format_buffer,
178  sizeof(new_format_buffer),
179  " %n", "g]")) {
180  err = logsys_format_set(new_format_buffer);
181  }
182  } else
183  if (strcmp (value, "off") == 0) {
184  /* nothing to do here */
185  } else {
186  error_reason = "unknown value for function_name";
187  free(value);
188  goto parse_error;
189  }
190 
191  free(value);
192  }
193 
194  if (err) {
195  error_reason = "not enough memory to set logging format buffer";
196  goto parse_error;
197  }
198 
199  if (map_get_string("logging.timestamp", &value) == CS_OK) {
200  if (strcmp (value, "on") == 0) {
201  if(!insert_into_buffer(new_format_buffer,
202  sizeof(new_format_buffer),
203  "%t ", NULL)) {
204  err = logsys_format_set(new_format_buffer);
205  }
206  } else
207  if (strcmp (value, "off") == 0) {
208  /* nothing to do here */
209  } else {
210  error_reason = "unknown value for timestamp";
211  free(value);
212  goto parse_error;
213  }
214 
215  free(value);
216  }
217 
218  if (err) {
219  error_reason = "not enough memory to set logging format buffer";
220  goto parse_error;
221  }
222 
223  return (0);
224 
225 parse_error:
226  *error_string = error_reason;
227 
228  return (-1);
229 }
230 
231 static int corosync_main_config_log_destination_set (
232  const char *path,
233  const char *key,
234  const char *subsys,
235  const char **error_string,
236  unsigned int mode_mask,
237  char deprecated,
238  char default_value,
239  const char *replacement)
240 {
241  static char formatted_error_reason[128];
242  char *value = NULL;
243  unsigned int mode;
244  char key_name[MAP_KEYNAME_MAXLEN];
245 
246  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, key);
247  if (map_get_string(key_name, &value) == CS_OK) {
248  if (deprecated) {
250  "Warning: the %s config parameter has been obsoleted."
251  " See corosync.conf man page %s directive.",
252  key, replacement);
253  }
254 
255  mode = logsys_config_mode_get (subsys);
256 
257  if (strcmp (value, "yes") == 0 || strcmp (value, "on") == 0) {
258  mode |= mode_mask;
259  if (logsys_config_mode_set(subsys, mode) < 0) {
260  sprintf (formatted_error_reason, "unable to set mode %s", key);
261  goto parse_error;
262  }
263  } else
264  if (strcmp (value, "no") == 0 || strcmp (value, "off") == 0) {
265  mode &= ~mode_mask;
266  if (logsys_config_mode_set(subsys, mode) < 0) {
267  sprintf (formatted_error_reason, "unable to unset mode %s", key);
268  goto parse_error;
269  }
270  } else {
271  sprintf (formatted_error_reason, "unknown value for %s", key);
272  goto parse_error;
273  }
274  }
275  /* Set to default if we are the top-level logger */
276  else if (!subsys && !deprecated) {
277 
278  mode = logsys_config_mode_get (subsys);
279  if (default_value) {
280  mode |= mode_mask;
281  }
282  else {
283  mode &= ~mode_mask;
284  }
285  if (logsys_config_mode_set(subsys, mode) < 0) {
286  sprintf (formatted_error_reason, "unable to change mode %s", key);
287  goto parse_error;
288  }
289  }
290 
291  free(value);
292  return (0);
293 
294 parse_error:
295  *error_string = formatted_error_reason;
296  free(value);
297  return (-1);
298 }
299 
300 static int corosync_main_config_set (
301  const char *path,
302  const char *subsys,
303  const char **error_string)
304 {
305  const char *error_reason = error_string_response;
306  char *value = NULL;
307  int mode;
308  char key_name[MAP_KEYNAME_MAXLEN];
309 
310  /*
311  * this bit abuses the internal logsys exported API
312  * to guarantee that all configured subsystems are
313  * initialized too.
314  *
315  * using this approach avoids some headaches caused
316  * by IPC and TOTEM that have a special logging
317  * handling requirements
318  */
319  if (subsys != NULL) {
320  if (_logsys_subsys_create(subsys, NULL) < 0) {
321  error_reason = "unable to create new logging subsystem";
322  goto parse_error;
323  }
324  }
325 
326  mode = logsys_config_mode_get(subsys);
327  if (mode < 0) {
328  error_reason = "unable to get mode";
329  goto parse_error;
330  }
331 
332  if (corosync_main_config_log_destination_set (path, "to_stderr", subsys, &error_reason,
333  LOGSYS_MODE_OUTPUT_STDERR, 0, 1, NULL) != 0)
334  goto parse_error;
335 
336  if (corosync_main_config_log_destination_set (path, "to_syslog", subsys, &error_reason,
337  LOGSYS_MODE_OUTPUT_SYSLOG, 0, 1, NULL) != 0)
338  goto parse_error;
339 
340  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_facility");
341  if (map_get_string(key_name, &value) == CS_OK) {
342  int syslog_facility;
343 
344  syslog_facility = qb_log_facility2int(value);
345  if (syslog_facility < 0) {
346  error_reason = "unknown syslog facility specified";
347  goto parse_error;
348  }
350  syslog_facility) < 0) {
351  error_reason = "unable to set syslog facility";
352  goto parse_error;
353  }
354 
355  free(value);
356  }
357  else {
358  /* Set default here in case of a reload */
360  qb_log_facility2int("daemon")) < 0) {
361  error_reason = "unable to set syslog facility";
362  goto parse_error;
363  }
364  }
365 
366  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_level");
367  if (map_get_string(key_name, &value) == CS_OK) {
368  int syslog_priority;
369 
371  "Warning: the syslog_level config parameter has been obsoleted."
372  " See corosync.conf man page syslog_priority directive.");
373 
374  syslog_priority = logsys_priority_id_get(value);
375  free(value);
376 
377  if (syslog_priority < 0) {
378  error_reason = "unknown syslog level specified";
379  goto parse_error;
380  }
382  syslog_priority) < 0) {
383  error_reason = "unable to set syslog level";
384  goto parse_error;
385  }
386  }
387 
388  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "syslog_priority");
389  if (map_get_string(key_name, &value) == CS_OK) {
390  int syslog_priority;
391 
392  syslog_priority = logsys_priority_id_get(value);
393  free(value);
394  if (syslog_priority < 0) {
395  error_reason = "unknown syslog priority specified";
396  goto parse_error;
397  }
399  syslog_priority) < 0) {
400  error_reason = "unable to set syslog priority";
401  goto parse_error;
402  }
403  }
404  else {
406  logsys_priority_id_get("info")) < 0) {
407  error_reason = "unable to set syslog level";
408  goto parse_error;
409  }
410  }
411 
412 #ifdef LOGCONFIG_USE_ICMAP
413  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile");
414  if (map_get_string(key_name, &value) == CS_OK) {
415  if (logsys_config_file_set (subsys, &error_reason, value) < 0) {
416  goto parse_error;
417  }
418  free(value);
419  }
420 #else
421  if (!subsys) {
422  if (logsys_config_file_set (subsys, &error_reason, main_logfile) < 0) {
423  goto parse_error;
424  }
425  }
426 #endif
427 
428  if (corosync_main_config_log_destination_set (path, "to_file", subsys, &error_reason,
429  LOGSYS_MODE_OUTPUT_FILE, 1, 0, "to_logfile") != 0)
430  goto parse_error;
431 
432  if (corosync_main_config_log_destination_set (path, "to_logfile", subsys, &error_reason,
433  LOGSYS_MODE_OUTPUT_FILE, 0, 0, NULL) != 0)
434  goto parse_error;
435 
436  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "logfile_priority");
437  if (map_get_string(key_name, &value) == CS_OK) {
438  int logfile_priority;
439 
440  logfile_priority = logsys_priority_id_get(value);
441  free(value);
442  if (logfile_priority < 0) {
443  error_reason = "unknown logfile priority specified";
444  goto parse_error;
445  }
447  logfile_priority) < 0) {
448  error_reason = "unable to set logfile priority";
449  goto parse_error;
450  }
451  }
452  else {
454  logsys_priority_id_get("info")) < 0) {
455  error_reason = "unable to set syslog level";
456  goto parse_error;
457  }
458  }
459 
460  snprintf(key_name, MAP_KEYNAME_MAXLEN, "%s.%s", path, "debug");
461  if (map_get_string(key_name, &value) == CS_OK) {
462  if (strcmp (value, "trace") == 0) {
463  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_TRACE) < 0) {
464  error_reason = "unable to set debug trace";
465  free(value);
466  goto parse_error;
467  }
468  } else
469  if (strcmp (value, "on") == 0) {
470  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_ON) < 0) {
471  error_reason = "unable to set debug on";
472  free(value);
473  goto parse_error;
474  }
475  } else
476  if (strcmp (value, "off") == 0) {
477  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
478  error_reason = "unable to set debug off";
479  free(value);
480  goto parse_error;
481  }
482  } else {
483  error_reason = "unknown value for debug";
484  free(value);
485  goto parse_error;
486  }
487  free(value);
488  }
489  else {
490  if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
491  error_reason = "unable to set debug off";
492  free(value);
493  goto parse_error;
494  }
495  }
496 
497  return (0);
498 
499 parse_error:
500  *error_string = error_reason;
501 
502  return (-1);
503 }
504 
505 static int corosync_main_config_read_logging (
506  const char **error_string)
507 {
508  const char *error_reason;
509 #ifdef LOGCONFIG_USE_ICMAP
510  icmap_iter_t iter;
511  const char *key_name;
512 #else
513  cmap_iter_handle_t iter;
514  char key_name[CMAP_KEYNAME_MAXLEN];
515 #endif
516  char key_subsys[MAP_KEYNAME_MAXLEN];
517  char key_item[MAP_KEYNAME_MAXLEN];
518  int res;
519 
520  /* format set is supported only for toplevel */
521  if (corosync_main_config_format_set(&error_reason) < 0) {
522  goto parse_error;
523  }
524 
525  if (corosync_main_config_set ("logging", NULL, &error_reason) < 0) {
526  goto parse_error;
527  }
528 
529  /*
530  * we will need 2 of these to compensate for new logging
531  * config format
532  */
533 #ifdef LOGCONFIG_USE_ICMAP
534  iter = icmap_iter_init("logging.logger_subsys.");
535  while ((key_name = icmap_iter_next(iter, NULL, NULL)) != NULL) {
536 #else
537  cmap_iter_init(cmap_handle, "logging.logger_subsys.", &iter);
538  while ((cmap_iter_next(cmap_handle, iter, key_name, NULL, NULL)) == CS_OK) {
539 #endif
540  res = sscanf(key_name, "logging.logger_subsys.%[^.].%s", key_subsys, key_item);
541 
542  if (res != 2) {
543  continue ;
544  }
545 
546  if (strcmp(key_item, "subsys") != 0) {
547  continue ;
548  }
549 
550  snprintf(key_item, MAP_KEYNAME_MAXLEN, "logging.logger_subsys.%s", key_subsys);
551 
552  if (corosync_main_config_set(key_item, key_subsys, &error_reason) < 0) {
553  goto parse_error;
554  }
555  }
556 #ifdef LOGCONFIG_USE_ICMAP
557  icmap_iter_finalize(iter);
558 #else
560 #endif
561 
563  return 0;
564 
565 parse_error:
566  *error_string = error_reason;
567 
568  return (-1);
569 }
570 
571 #ifdef LOGCONFIG_USE_ICMAP
572 static void main_logging_notify(
573  int32_t event,
574  const char *key_name,
575  struct icmap_notify_value new_val,
576  struct icmap_notify_value old_val,
577  void *user_data)
578 #else
579 static void main_logging_notify(
580  cmap_handle_t cmap_handle_unused,
581  cmap_handle_t cmap_track_handle_unused,
582  int32_t event,
583  const char *key_name,
584  struct cmap_notify_value new_val,
585  struct cmap_notify_value old_val,
586  void *user_data)
587 #endif
588 {
589  const char *error_string;
590  static int reload_in_progress = 0;
591 
592  /* If a full reload happens then suspend updates for individual keys until
593  * it's all completed
594  */
595  if (strcmp(key_name, "config.reload_in_progress") == 0) {
596  if (*(uint8_t *)new_val.data == 1) {
597  reload_in_progress = 1;
598  } else {
599  reload_in_progress = 0;
600  }
601  }
602  if (reload_in_progress) {
603  log_printf(LOGSYS_LEVEL_DEBUG, "Ignoring key change, reload in progress. %s\n", key_name);
604  return;
605  }
606 
607  /*
608  * Reload the logsys configuration
609  */
610  if (logsys_format_set(NULL) == -1) {
611  fprintf (stderr, "Unable to setup logging format.\n");
612  }
613  corosync_main_config_read_logging(&error_string);
614 }
615 
616 #ifdef LOGCONFIG_USE_ICMAP
617 static void add_logsys_config_notification(void)
618 {
619  icmap_track_t icmap_track = NULL;
620 
621  icmap_track_add("logging.",
623  main_logging_notify,
624  NULL,
625  &icmap_track);
626 
627  icmap_track_add("config.reload_in_progress",
629  main_logging_notify,
630  NULL,
631  &icmap_track);
632 }
633 #else
634 static void add_logsys_config_notification(void)
635 {
636  cmap_track_handle_t cmap_track;
637 
638  cmap_track_add(cmap_handle, "logging.",
640  main_logging_notify,
641  NULL,
642  &cmap_track);
643 
644  cmap_track_add(cmap_handle, "config.reload_in_progress",
646  main_logging_notify,
647  NULL,
648  &cmap_track);
649 }
650 #endif
651 
653 #ifndef LOGCONFIG_USE_ICMAP
654  cmap_handle_t cmap_h,
655  const char *default_logfile,
656 #endif
657  const char **error_string)
658 {
659  const char *error_reason = error_string_response;
660 
661 #ifndef LOGCONFIG_USE_ICMAP
662  if (!cmap_h) {
663  error_reason = "No cmap handle";
664  return (-1);
665  }
666  if (!default_logfile) {
667  error_reason = "No default logfile";
668  return (-1);
669  }
670  cmap_handle = cmap_h;
671  main_logfile = default_logfile;
672 #endif
673 
674  if (corosync_main_config_read_logging(error_string) < 0) {
675  error_reason = *error_string;
676  goto parse_error;
677  }
678 
679  add_logsys_config_notification();
680 
681  return 0;
682 
683 parse_error:
684  snprintf (error_string_response, sizeof(error_string_response),
685  "parse error in config: %s.\n",
686  error_reason);
687 
688  *error_string = error_string_response;
689  return (-1);
690 }
#define LOGSYS_DEBUG_TRACE
Definition: logsys.h:92
#define CMAP_TRACK_DELETE
Definition: cmap.h:79
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:933
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:1103
#define MAP_KEYNAME_MAXLEN
Definition: logconfig.c:49
#define CMAP_TRACK_MODIFY
Definition: cmap.h:80
uint32_t value
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
Definition: icmap.c:1124
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:836
cmap_handle_t cmap_handle
Definition: sam.c:136
#define CMAP_TRACK_ADD
Definition: cmap.h:78
#define map_get_string(key_name, value)
Definition: logconfig.c:50
#define CMAP_KEYNAME_MAXLEN
Definition: cmap.h:69
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:540
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:781
int _logsys_subsys_create(const char *subsys, const char *filename)
_logsys_subsys_create
Definition: logsys.c:436
#define LOGSYS_DEBUG_ON
Definition: logsys.h:91
#define log_printf(level, format, args...)
Definition: logsys.h:319
Structure passed as new_value and old_value in change callback.
Definition: cmap.h:111
#define LOGSYS_MODE_OUTPUT_FILE
Definition: logsys.h:58
cs_error_t cmap_iter_finalize(cmap_handle_t handle, cmap_iter_handle_t iter_handle)
Finalize iterator.
Definition: lib/cmap.c:894
#define ICMAP_TRACK_DELETE
Definition: icmap.h:77
const void * data
Definition: cmap.h:114
#define LOGSYS_LEVEL_WARNING
Definition: logsys.h:71
#define ICMAP_TRACK_MODIFY
Definition: icmap.h:78
int logsys_config_debug_set(const char *subsys, unsigned int value)
enabling debug, disable message priority filtering.
Definition: logsys.c:782
int logsys_config_syslog_facility_set(const char *subsys, unsigned int facility)
per system/subsystem settings.
Definition: logsys.c:649
int logsys_config_mode_set(const char *subsys, unsigned int mode)
logsys_config_mode_set
Definition: logsys.c:506
void * user_data
Definition: sam.c:126
char * logsys_format_get(void)
logsys_format_get
Definition: logsys.c:644
#define LOGSYS_MODE_OUTPUT_SYSLOG
Definition: logsys.h:60
#define ICMAP_TRACK_ADD
Definition: icmap.h:76
#define LOGSYS_DEBUG_OFF
Definition: logsys.h:90
int corosync_log_config_read(cmap_handle_t cmap_h, const char *default_logfile, const char **error_string)
Definition: logconfig.c:652
#define LOGSYS_LEVEL_DEBUG
Definition: logsys.h:74
uint64_t cmap_track_handle_t
Definition: cmap.h:64
int logsys_config_syslog_priority_set(const char *subsys, unsigned int priority)
logsys_config_syslog_priority_set
Definition: logsys.c:656
#define CMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
Definition: cmap.h:87
void logsys_config_apply(void)
logsys_config_apply
Definition: logsys.c:770
int logsys_priority_id_get(const char *name)
logsys_priority_id_get
Definition: logsys.c:808
uint64_t cmap_iter_handle_t
Definition: cmap.h:59
unsigned int logsys_config_mode_get(const char *subsys)
logsys_config_mode_get
Definition: logsys.c:528
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
Definition: icmap.c:1097
int logsys_config_logfile_priority_set(const char *subsys, unsigned int priority)
logsys_config_logfile_priority_set
Definition: logsys.c:683
uint64_t cmap_handle_t
Definition: cmap.h:54
#define LOGSYS_MODE_OUTPUT_STDERR
Definition: logsys.h:59
qb_map_iter_t * icmap_iter_t
Itterator type.
Definition: icmap.h:123
Structure passed as new_value and old_value in change callback.
Definition: icmap.h:91
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:1167
int logsys_format_set(const char *format)
configuration bits that can only be done for the whole system
Definition: logsys.c:586
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
Definition: icmap.h:85