diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/compat_libevent.c | 10 | ||||
-rw-r--r-- | src/common/log.c | 4 | ||||
-rw-r--r-- | src/common/torlog.h | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c index 250fa2bdb7..96843c73e4 100644 --- a/src/common/compat_libevent.c +++ b/src/common/compat_libevent.c @@ -65,19 +65,19 @@ libevent_logging_callback(int severity, const char *msg) } switch (severity) { case _EVENT_LOG_DEBUG: - log(LOG_DEBUG, LD_NET, "Message from libevent: %s", buf); + log(LOG_DEBUG, LD_NOCB|LD_NET, "Message from libevent: %s", buf); break; case _EVENT_LOG_MSG: - log(LOG_INFO, LD_NET, "Message from libevent: %s", buf); + log(LOG_INFO, LD_NOCB|LD_NET, "Message from libevent: %s", buf); break; case _EVENT_LOG_WARN: - log(LOG_WARN, LD_GENERAL, "Warning from libevent: %s", buf); + log(LOG_WARN, LD_NOCB|LD_GENERAL, "Warning from libevent: %s", buf); break; case _EVENT_LOG_ERR: - log(LOG_ERR, LD_GENERAL, "Error from libevent: %s", buf); + log(LOG_ERR, LD_NOCB|LD_GENERAL, "Error from libevent: %s", buf); break; default: - log(LOG_WARN, LD_GENERAL, "Message [%d] from libevent: %s", + log(LOG_WARN, LD_NOCB|LD_GENERAL, "Message [%d] from libevent: %s", severity, buf); break; } diff --git a/src/common/log.c b/src/common/log.c index b639e7a781..0ccda53887 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -278,6 +278,10 @@ logv(int severity, log_domain_mask_t domain, const char *funcname, lf = lf->next; continue; } + if (lf->callback && (domain & LD_NOCB)) { + lf = lf->next; + continue; + } if (lf->seems_dead) { lf = lf->next; continue; diff --git a/src/common/torlog.h b/src/common/torlog.h index 21219569e3..8b6cd1bf02 100644 --- a/src/common/torlog.h +++ b/src/common/torlog.h @@ -95,6 +95,10 @@ /** Number of logging domains in the code. */ #define N_LOGGING_DOMAINS 20 +/** This log message is not safe to send to a callback-based logger. + * Used as a flag, not a log domain. */ +#define LD_NOCB (1u<<31) + typedef uint32_t log_domain_mask_t; /** Configures which severities are logged for each logging domain for a given |