From 08cbabbfb79d8e618c2fd0c9e0398d8ffee4a6c3 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 6 Oct 2009 17:39:28 +0200 Subject: Don't log source filename and line number if DEBUG is not enabled --- common/eurephia_log.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'common') diff --git a/common/eurephia_log.c b/common/eurephia_log.c index dde99d8..aa80c07 100644 --- a/common/eurephia_log.c +++ b/common/eurephia_log.c @@ -75,13 +75,13 @@ static inline const char *logprio_str(int prio) { */ static const int syslog_priority[] = { -1, - LOG_INFO, /**< LOG_INFO */ - LOG_DEBUG, /**< LOG_DEBUG */ - LOG_WARNING, /**< LOG_WARNING */ - LOG_ERR, /**< LOG_ERROR */ - LOG_CRIT, /**< LOG_CRITICAL */ - LOG_ALERT, /**< LOG_FATAL */ - LOG_EMERG /**< LOG_PANIC */ + LOG_INFO, /**< LOG_INFO */ + LOG_DEBUG, /**< LOG_DEBUG */ + LOG_WARNING, /**< LOG_WARNING */ + LOG_ERR, /**< LOG_ERROR */ + LOG_CRIT, /**< LOG_CRITICAL */ + LOG_ALERT, /**< LOG_FATAL */ + LOG_EMERG /**< LOG_PANIC */ }; @@ -191,7 +191,11 @@ static void file_log(FILE *log, int logdst, int loglvl, const char *file, const // Do the logging pthread_mutex_lock(&log_mutex); // Block other threads from writing when we write +#ifdef ENABLE_DEBUG fprintf(log, "[%s] %s [%i] {%s:%i} ", tstmp_str, logprio_str(logdst), loglvl, file, line); +#else + fprintf(log, "[%s] %s [%i] ", tstmp_str, logprio_str(logdst), loglvl); +#endif vfprintf(log, fmt, ap); fprintf(log, "\n"); fflush(log); -- cgit