diff options
author | Junaid <junaid@gluster.com> | 2011-06-29 03:13:56 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-11 23:19:17 -0700 |
commit | ae5f7c2c1d88cee0029c555f2416fe7c998cc1c2 (patch) | |
tree | 04af992d5c2498d542934dd487bb7c487668a60b /libglusterfs | |
parent | e9d960391794db917bd3e984c8dc3fd7e3cec706 (diff) |
libglusterfs/logging: Added functions to set sys-log-level.
Signed-off-by: Junaid <junaid@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3044 (provide option to set syslog loglevel through CLI)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3044
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/logging.c | 13 | ||||
-rw-r--r-- | libglusterfs/src/logging.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index a492ac450..7db197928 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -50,6 +50,7 @@ static uint8_t logrotate = 0; static FILE *logfile = NULL; static gf_loglevel_t loglevel = GF_LOG_INFO; static int gf_log_syslog = 1; +static gf_loglevel_t sys_log_level = GF_LOG_CRITICAL; char gf_log_xl_log_set; gf_loglevel_t gf_log_loglevel = GF_LOG_INFO; /* extern'd */ @@ -186,6 +187,12 @@ gf_log_cleanup (void) pthread_mutex_destroy (&logfile_mutex); } +void +set_sys_log_level (gf_loglevel_t level) +{ + sys_log_level = level; +} + int _gf_log_nomem (const char *domain, const char *file, const char *function, int line, gf_loglevel_t level, @@ -291,7 +298,7 @@ _gf_log_nomem (const char *domain, const char *file, #ifdef GF_LINUX_HOST_OS /* We want only serious log in 'syslog', not our debug and trace logs */ - if (gf_log_syslog && level && (level <= GF_LOG_ERROR)) + if (gf_log_syslog && level && (level <= sys_log_level)) syslog ((level-1), "%s\n", msg); #endif } @@ -424,7 +431,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, #ifdef GF_LINUX_HOST_OS /* We want only serious log in 'syslog', not our debug and trace logs */ - if (gf_log_syslog && level && (level <= GF_LOG_CRITICAL)) + if (gf_log_syslog && level && (level <= sys_log_level)) syslog ((level-1), "%s\n", msg); #endif } @@ -562,7 +569,7 @@ log: #ifdef GF_LINUX_HOST_OS /* We want only serious log in 'syslog', not our debug and trace logs */ - if (gf_log_syslog && level && (level <= GF_LOG_CRITICAL)) + if (gf_log_syslog && level && (level <= sys_log_level)) syslog ((level-1), "%s\n", msg); #endif } diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index 0a76f1612..9441943a0 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -146,4 +146,6 @@ void gf_log_set_xl_loglevel (void *xl, gf_loglevel_t level); int gf_cmd_log (const char *domain, const char *fmt, ...); int gf_cmd_log_init (const char *filename); + +void set_sys_log_level (gf_loglevel_t level); #endif /* __LOGGING_H__ */ |