diff --git a/daemon/call.c b/daemon/call.c index 87a48885f..397d521c6 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2107,7 +2107,7 @@ static struct call *call_create(const str *callid, struct callmaster *m) { struct call *c; ilog(LOG_NOTICE, "["STR_FORMAT"] Creating new call", - STR_FMT(callid)); /* XXX will spam syslog on recovery from DB */ + STR_FMT(callid)); c = obj_alloc0("call", sizeof(*c), __call_free); c->callmaster = m; mutex_init(&c->buffer_lock); diff --git a/daemon/log.c b/daemon/log.c index 39b1f53ee..687ffb74d 100644 --- a/daemon/log.c +++ b/daemon/log.c @@ -17,10 +17,18 @@ void ilog(int prio, const char *fmt, ...) { char prefix[256]; char *msg; va_list ap; - int ret; + int ret, xprio; - if (prio > g_atomic_int_get(&log_level)) + xprio = LOG_LEVEL_MASK(prio); + +#ifndef __DEBUG + int level; /* thank you C99 */ + level = g_atomic_int_get(&log_level); + if (xprio > LOG_LEVEL_MASK(level)) + return; + if ((level & LOG_FLAG_RESTORE) && !(prio & LOG_FLAG_RESTORE)) return; +#endif switch (log_info.e) { case LOG_INFO_NONE: @@ -47,7 +55,7 @@ void ilog(int prio, const char *fmt, ...) { return; } - syslog(prio, "%s%s", prefix, msg); + syslog(xprio, "%s%s", prefix, msg); free(msg); } diff --git a/daemon/log.h b/daemon/log.h index baba54655..fa6db2e1d 100644 --- a/daemon/log.h +++ b/daemon/log.h @@ -76,5 +76,10 @@ INLINE void log_info_stream_fd(struct stream_fd *sfd) { #define LOG_WARN LOG_WARNING +#define LOG_LEVEL_MASK(v) ((v) & 0x0f) + +#define LOG_FLAG_RESTORE 0x10 + + #endif