From b7d43986eb33811071173d394b5778bede6188c1 Mon Sep 17 00:00:00 2001 From: Mohamed Ashiq Date: Wed, 29 Jul 2015 23:47:34 +0530 Subject: logging : GF_LOG_NONE logs always Shouldn't GF_LOG_NONE mean "Never log this"? If so, it's not being tested for and is, instead, treated as a higher priority than CRITICAL thus is always logged. Backport of http://review.gluster.org/11797 Cherry picked from 7b390983768e833a8df15b994038155c53d71bdd >Change-Id: Icad1e02a720a05ff21bd54ebf19c0032e6d5ce03 >BUG: 1246794 >Signed-off-by: Mohamed Ashiq >Reviewed-on: http://review.gluster.org/11797 >Reviewed-by: Raghavendra Talur >Tested-by: NetBSD Build System Change-Id: Icad1e02a720a05ff21bd54ebf19c0032e6d5ce03 BUG: 1259167 Signed-off-by: Mohamed Ashiq Reviewed-on: http://review.gluster.org/12087 Tested-by: NetBSD Build System Reviewed-by: Raghavendra Talur Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- libglusterfs/src/logging.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index af14163c360..511b1037384 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -798,7 +798,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; static char *level_strings[] = {"", /* NONE */ @@ -987,7 +987,7 @@ _gf_msg_plain (gf_loglevel_t level, const char *fmt, ...) if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; va_start (ap, fmt); @@ -1023,7 +1023,7 @@ _gf_msg_vplain (gf_loglevel_t level, const char *fmt, va_list ap) if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; ret = vasprintf (&msg, fmt, ap); @@ -1055,7 +1055,7 @@ _gf_msg_plain_nomem (gf_loglevel_t level, const char *msg) if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; ret = _gf_msg_plain_internal (level, msg); @@ -1087,7 +1087,7 @@ _gf_msg_backtrace_nomem (gf_loglevel_t level, int stacksize) if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; bt_size = backtrace (array, ((stacksize <= 200)? stacksize : 200)); @@ -1174,7 +1174,7 @@ _gf_msg_nomem (const char *domain, const char *file, if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; if (!domain || !file || !function) { @@ -2043,7 +2043,7 @@ _gf_msg (const char *domain, const char *file, const char *function, if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; if (trace) { @@ -2124,7 +2124,7 @@ _gf_log (const char *domain, const char *file, const char *function, int line, if (this->loglevel && (level > this->loglevel)) goto out; } - if (level > ctx->log.loglevel) + if (level > ctx->log.loglevel || level == GF_LOG_NONE) goto out; static char *level_strings[] = {"", /* NONE */ -- cgit