[or-cvs] Add code to suppress spurious libevent log msgs; use it to ...

Nick Mathewson nickm at seul.org
Fri Apr 1 07:05:23 UTC 2005


Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv3632/src/common

Modified Files:
	log.c log.h 
Log Message:
Add code to suppress spurious libevent log msgs; use it to resolve bug 68.

Index: log.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- log.c	1 Apr 2005 02:37:39 -0000	1.88
+++ log.c	1 Apr 2005 07:05:20 -0000	1.89
@@ -482,8 +482,11 @@
 }
 
 #ifdef HAVE_EVENT_SET_LOG_CALLBACK
+static const char *suppress_msg = NULL;
 void libevent_logging_callback(int severity, const char *msg)
 {
+  if (suppress_msg && strstr(msg, suppress_msg))
+    return;
   switch (severity) {
     case _EVENT_LOG_DEBUG:
       log(LOG_DEBUG, "Message from libevent: %s", msg);
@@ -506,6 +509,10 @@
 {
   event_set_log_callback(libevent_logging_callback);
 }
+void suppress_libevent_log_msg(const char *msg)
+{
+  suppress_msg = msg;
+}
 #else
 void configure_libevent_logging(void) {}
 #endif

Index: log.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- log.h	1 Apr 2005 02:37:39 -0000	1.41
+++ log.h	1 Apr 2005 07:05:20 -0000	1.42
@@ -67,6 +67,7 @@
 void close_temp_logs(void);
 void mark_logs_temp(void);
 void configure_libevent_logging(void);
+void suppress_libevent_log_msg(const char *msg);
 
 /* Outputs a message to stdout */
 void _log(int severity, const char *format, ...) CHECK_PRINTF(2,3);



More information about the tor-commits mailing list