From 5046fc8f267851b4ce530f8a3ba41d5ac5c9ea87 Mon Sep 17 00:00:00 2001 From: Mohamed Ashiq Date: Wed, 12 Aug 2015 15:21:17 +0530 Subject: libglusterfs:Porting log messages to new framework Backport of http://review.gluster.org/11896 Cherry picked from 038dfe57cf0c5944b0392332dbf5a00bb1208150 >Change-Id: I8625b7dc8941720cc7a864b8fddbcc7b4c485fcd >BUG: 1252836 >Signed-off-by: Mohamed Ashiq >Reviewed-on: http://review.gluster.org/11896 >Tested-by: NetBSD Build System >Tested-by: Gluster Build System >Reviewed-by: Manikandan Selvaganesh >Reviewed-by: Niels de Vos Change-Id: I8625b7dc8941720cc7a864b8fddbcc7b4c485fcd BUG: 1258769 Signed-off-by: Mohamed Ashiq Reviewed-on: http://review.gluster.org/12076 Reviewed-by: Manikandan Selvaganesh Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Niels de Vos --- libglusterfs/src/libglusterfs-messages.h | 26 +++++++++++++++++++++++++- libglusterfs/src/run.c | 4 ++-- libglusterfs/src/timespec.c | 5 +---- libglusterfs/src/xlator.c | 10 ++++++---- 4 files changed, 34 insertions(+), 11 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/libglusterfs-messages.h b/libglusterfs/src/libglusterfs-messages.h index 25cca8bac3e..68754e6b869 100644 --- a/libglusterfs/src/libglusterfs-messages.h +++ b/libglusterfs/src/libglusterfs-messages.h @@ -36,7 +36,7 @@ */ #define GLFS_LG_BASE GLFS_MSGID_COMP_LIBGLUSTERFS -#define GLFS_LG_NUM_MESSAGES 201 +#define GLFS_LG_NUM_MESSAGES 204 #define GLFS_LG_MSGID_END (GLFS_LG_BASE + GLFS_LG_NUM_MESSAGES + 1) /* Messaged with message IDs */ #define glfs_msg_start_lg GLFS_LG_BASE, "Invalid: Start of messages" @@ -1716,6 +1716,30 @@ */ #define LG_MSG_LOCK_FAILURE (GLFS_LG_BASE + 201) +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ +#define LG_MSG_SET_LOG_LEVEL (GLFS_LG_BASE + 202) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ +#define LG_MSG_VERIFY_PLATFORM (GLFS_LG_BASE + 203) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ +#define LG_MSG_RUNNER_LOG (GLFS_LG_BASE + 204) + /*! * @messageid * @diagnosis diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c index 5d7f1d207b1..6018a58ad5f 100644 --- a/libglusterfs/src/run.c +++ b/libglusterfs/src/run.c @@ -43,8 +43,8 @@ #include "common-utils.h" #endif +#include "libglusterfs-messages.h" #include "run.h" - void runinit (runner_t *runner) { @@ -187,7 +187,7 @@ runner_log (runner_t *runner, const char *dom, gf_loglevel_t lvl, if (len > 0) buf[len - 1] = '\0'; - gf_log_callingfn (dom, lvl, "%s: %s", msg, buf); + gf_msg_callingfn (dom, lvl, 0, LG_MSG_RUNNER_LOG, "%s: %s", msg, buf); GF_FREE (buf); } diff --git a/libglusterfs/src/timespec.c b/libglusterfs/src/timespec.c index 5242ecc8cd0..f7b2bea2f30 100644 --- a/libglusterfs/src/timespec.c +++ b/libglusterfs/src/timespec.c @@ -20,6 +20,7 @@ static mach_timebase_info_data_t gf_timebase; #include "logging.h" #include "timespec.h" +#include "libglusterfs-messages.h" void timespec_now (struct timespec *ts) { @@ -51,10 +52,6 @@ void timespec_now (struct timespec *ts) ts->tv_nsec = (time - (ts->tv_sec * GIGA)); #endif /* Platform verification */ - /* - gf_log_callingfn ("timer", GF_LOG_TRACE, "%"GF_PRI_TIME".%09"GF_PRI_TIME, - ts->tv_sec, ts->tv_nsec); - */ } void timespec_adjust_delta (struct timespec *ts, struct timespec delta) diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 52f96c94a50..0de13900914 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -981,8 +981,8 @@ is_gf_log_command (xlator_t *this, const char *name, char *value) /* Some crude way to change the log-level of process */ if (!strcmp (name, "trusted.glusterfs.set-log-level")) { - /* */ - gf_log ("glusterfs", gf_log_get_loglevel(), + gf_msg ("glusterfs", gf_log_get_loglevel(), 0, + LG_MSG_SET_LOG_LEVEL, "setting log level to %d (old-value=%d)", log_level, gf_log_get_loglevel()); gf_log_set_loglevel (log_level); @@ -992,7 +992,8 @@ is_gf_log_command (xlator_t *this, const char *name, char *value) if (!strcmp (name, "trusted.glusterfs.fuse.set-log-level")) { /* */ - gf_log (this->name, gf_log_get_xl_loglevel (this), + gf_msg (this->name, gf_log_get_xl_loglevel (this), 0, + LG_MSG_SET_LOG_LEVEL, "setting log level to %d (old-value=%d)", log_level, gf_log_get_xl_loglevel (this)); gf_log_set_xl_loglevel (this, log_level); @@ -1011,7 +1012,8 @@ is_gf_log_command (xlator_t *this, const char *name, char *value) snprintf (key, 1024, "trusted.glusterfs.%s.set-log-level", trav->name); if (fnmatch (name, key, FNM_NOESCAPE) == 0) { - gf_log (trav->name, gf_log_get_xl_loglevel (trav), + gf_msg (trav->name, gf_log_get_xl_loglevel (trav), 0, + LG_MSG_SET_LOG_LEVEL, "setting log level to %d (old-value=%d)", log_level, gf_log_get_xl_loglevel (trav)); gf_log_set_xl_loglevel (trav, log_level); -- cgit