summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/logging.c
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-06-29 03:13:56 +0000
committerAnand Avati <avati@gluster.com>2011-07-11 23:19:17 -0700
commitae5f7c2c1d88cee0029c555f2416fe7c998cc1c2 (patch)
tree04af992d5c2498d542934dd487bb7c487668a60b /libglusterfs/src/logging.c
parente9d960391794db917bd3e984c8dc3fd7e3cec706 (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/src/logging.c')
-rw-r--r--libglusterfs/src/logging.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index a492ac450d3..7db1979285a 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
}