Explorar o código

Allow users of logsys to disable output of logging LOG_LEVEL_DEBUG messages
via log_mode_set.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1576 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake %!s(int64=17) %!d(string=hai) anos
pai
achega
eef9f0644b
Modificáronse 3 ficheiros con 5 adicións e 2 borrados
  1. 3 1
      exec/logsys.c
  2. 1 0
      exec/logsys.h
  3. 1 1
      man/logsys_overview.8

+ 3 - 1
exec/logsys.c

@@ -277,7 +277,9 @@ static void log_printf_worker_fn (void *thread_data, void *work_item)
 		fflush (stdout);
 	}
 
-	if (logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) {
+	if ((logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) &&
+		(!((logsys_mode & LOG_MODE_FILTER_DEBUG_FROM_SYSLOG) &&
+		   (log_data->priority == LOG_LEVEL_DEBUG)))) {
 		syslog (log_data->priority,
 			&log_data->log_string[log_data->syslog_pos]);
 	}

+ 1 - 0
exec/logsys.h

@@ -55,6 +55,7 @@
 #define LOG_MODE_FLUSH_AFTER_CONFIG	(1<<9)
 #define LOG_MODE_SHORT_FILELINE		(1<<10)
 #define LOG_MODE_NOSUBSYS		(1<<11)
+#define LOG_MODE_FILTER_DEBUG_FROM_SYSLOG	(1<<12)
 
 /*
  * Log priorities, compliant with syslog and SA Forum Log spec.

+ 1 - 1
man/logsys_overview.8

@@ -77,7 +77,7 @@ The file parameter specifies the filename that should be used to log messages.
 The facility parameter is the syslog facility that should be used when logging
 messages.
 LOG_MODE_NOSUBSYS: Enabling this mode removes the subsystem tag from the beginning of the log lines.  This is not recommended for programs which have multiple subsystems.
-
+LOG_MODE_FILTER_DEBUG_FROM_SYSLOG: Enabling this mode will stop debug messages from being sent to syslog.
 
 An example declaration would be: