libglusterfs:Porting log messages to new framework

Change-Id: I8625b7dc8941720cc7a864b8fddbcc7b4c485fcd
BUG: 1252836
Signed-off-by: Mohamed Ashiq <mliyazud@redhat.com>
Reviewed-on: http://review.gluster.org/11896
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Mohamed Ashiq 2015-08-12 15:21:17 +05:30 committed by Niels de Vos
parent 99cd07c596
commit 038dfe57cf
4 changed files with 34 additions and 11 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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)

View File

@ -976,8 +976,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);
@ -987,7 +987,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);
@ -1006,7 +1007,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);