Просмотр исходного кода

Split the logging config options into three keys: to_file, to_stderr & to_syslog

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@977 fd59a12c-fef9-0310-b244-a6a79926bd2f
Patrick Caulfield 20 лет назад
Родитель
Сommit
64a83a764f
3 измененных файлов с 28 добавлено и 21 удалено
  1. 2 1
      conf/openais.conf
  2. 18 14
      exec/mainconfig.c
  3. 8 6
      man/openais.conf.5

+ 2 - 1
conf/openais.conf

@@ -13,7 +13,8 @@ totem {
 }
 
 logging {
-	logoutput: stderr
+	to_stderr: yes
+	to_file: yes
 	logfile: /tmp/ais
 	debug: off
 	timestamp: on

+ 18 - 14
exec/mainconfig.c

@@ -51,14 +51,6 @@
 
 static char error_string_response[512];
 
-typedef enum {
-	MAIN_HEAD,
-	MAIN_LOGGING,
-	MAIN_EVENT,
-	MAIN_AMF,
-	MAIN_COMPONENTS
-} main_parse_t;
-
 /* This just makes the code below a little neater */
 static inline int objdb_get_string(struct objdb_iface_ver0 *objdb, unsigned int object_service_handle,
 				   char *key, char **value)
@@ -96,19 +88,31 @@ extern int openais_main_config_read (
 		    strlen ("logging"),
 		    &object_service_handle) == 0) {
 
-		if (!objdb_get_string (objdb,object_service_handle, "logoutput", &value)) {
-			if (strcmp (value, "file") == 0) {
+		if (!objdb_get_string (objdb,object_service_handle, "to_file", &value)) {
+			if (strcmp (value, "yes") == 0) {
 				main_config->logmode |= LOG_MODE_FILE;
 			} else
-			if (strcmp (value, "syslog") == 0) {
+			if (strcmp (value, "no") == 0) {
+				main_config->logmode &= ~LOG_MODE_FILE;
+			}
+		}
+		if (!objdb_get_string (objdb,object_service_handle, "to_syslog", &value)) {
+			if (strcmp (value, "yes") == 0) {
 				main_config->logmode |= LOG_MODE_SYSLOG;
 			} else
-			if (strcmp (value, "stderr") == 0) {
+			if (strcmp (value, "no") == 0) {
+				main_config->logmode &= ~LOG_MODE_SYSLOG;
+			}
+		}
+		if (!objdb_get_string (objdb,object_service_handle, "to_stderr", &value)) {
+			if (strcmp (value, "yes") == 0) {
 				main_config->logmode |= LOG_MODE_STDERR;
-			} else {
-				goto parse_error;
+			} else
+			if (strcmp (value, "no") == 0) {
+				main_config->logmode &= ~LOG_MODE_STDERR;
 			}
 		}
+
 		if (!objdb_get_string (objdb,object_service_handle, "debug", &value)) {
 			if (strcmp (value, "on") == 0) {
 				main_config->logmode |= LOG_MODE_DEBUG;

+ 8 - 6
man/openais.conf.5

@@ -327,13 +327,15 @@ The default is 17 messages.
 .PP
 Within the 
 .B logging
-directive, there are four configuration options which are all optional:
+directive, there are six configuration options which are all optional:
 .TP
-logoutput
-This specifies the logging output.  The choices are file, which logs to a file,
-stderr, which logs to stderr, and syslog which logs to the system log.  It is
-possible to have multiple targets by including this directive with different
-options multiple times in the top level directive.
+to_stderr
+.TP
+to_file
+.TP
+to_syslog
+These specify the destination of logging output. Any combination of
+these options may be specified.
 
 .TP
 logfile