From 2cd8411a0278f98ed820aad3e482de079d0540c0 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Mon, 25 Apr 2011 03:10:01 +0000 Subject: cli log level command and per translator log level Signed-off-by: Venky Shankar Signed-off-by: Anand Avati BUG: 2714 (implement cli log level command) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2714 --- libglusterfs/src/logging.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'libglusterfs/src/logging.c') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index eaa735d5f..550aadef1 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -196,19 +196,18 @@ _gf_log_nomem (const char *domain, const char *file, xlator_t *this = NULL; struct timeval tv = {0,}; int ret = 0; - gf_loglevel_t xlator_loglevel = 0; char msg[8092]; char timestr[256]; char callstr[4096]; this = THIS; - xlator_loglevel = this->loglevel; - if (xlator_loglevel == 0) - xlator_loglevel = loglevel; - - if (level > xlator_loglevel) - goto out; + if (gf_log_xl_log_set) { + if (this->loglevel && (level > this->loglevel)) + goto out; + else if (level > gf_log_loglevel) + goto out; + } static char *level_strings[] = {"", /* NONE */ "M", /* EMERGENCY */ @@ -318,17 +317,16 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, struct timeval tv = {0,}; size_t len = 0; int ret = 0; - gf_loglevel_t xlator_loglevel = 0; va_list ap; this = THIS; - xlator_loglevel = this->loglevel; - if (xlator_loglevel == 0) - xlator_loglevel = loglevel; - - if (level > xlator_loglevel) - goto out; + if (gf_log_xl_log_set) { + if (this->loglevel && (level > this->loglevel)) + goto out; + else if (level > gf_log_loglevel) + goto out; + } static char *level_strings[] = {"", /* NONE */ "M", /* EMERGENCY */ @@ -465,16 +463,15 @@ _gf_log (const char *domain, const char *file, const char *function, int line, size_t len = 0; int ret = 0; xlator_t *this = NULL; - gf_loglevel_t xlator_loglevel = 0; this = THIS; - xlator_loglevel = this->loglevel; - if (xlator_loglevel == 0) - xlator_loglevel = loglevel; - - if (level > xlator_loglevel) - goto out; + if (gf_log_xl_log_set) { + if (this->loglevel && (level > this->loglevel)) + goto out; + else if (level > gf_log_loglevel) + goto out; + } static char *level_strings[] = {"", /* NONE */ "M", /* EMERGENCY */ -- cgit