diff options
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/logging.c | 7 | ||||
-rw-r--r-- | libglusterfs/src/logging.h | 8 |
2 files changed, 6 insertions, 9 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index c152e4a28..4493b05c7 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -43,11 +43,11 @@ static pthread_mutex_t logfile_mutex; static char *filename = NULL; static uint8_t logrotate = 0; - static FILE *logfile = NULL; static gf_loglevel_t loglevel = GF_LOG_MAX; static int gf_log_syslog = 0; +char gf_log_xl_log_set; gf_loglevel_t gf_log_loglevel; /* extern'd */ FILE *gf_log_logfile; @@ -100,6 +100,7 @@ gf_log_set_xl_loglevel (void *this, gf_loglevel_t level) xlator_t *xl = this; if (!xl) return; + gf_log_xl_log_set = 1; xl->loglevel = level; } @@ -261,10 +262,6 @@ log: tm = localtime (&tv.tv_sec); - if (level > xlator_loglevel) { - goto out; - } - pthread_mutex_lock (&logfile_mutex); { va_start (ap, fmt); diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index 39b593850..e440d5975 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -73,14 +73,14 @@ typedef enum { #define GF_LOG_MAX GF_LOG_DEBUG extern gf_loglevel_t gf_log_loglevel; +extern char gf_log_xl_log_set; #define gf_log(dom, levl, fmt...) do { \ + if ((levl > gf_log_loglevel) && !gf_log_xl_log_set) \ + break; \ _gf_log (dom, __FILE__, __FUNCTION__, __LINE__, \ levl, ##fmt); \ - if (0) { \ - printf (fmt); \ - } \ -} while (0) + } while (0) /* Log once in GF_UNIVERSAL_ANSWER times */ #define GF_LOG_OCCASIONALLY(var, args...) if (!(var++%GF_UNIVERSAL_ANSWER)) { \ |