From 597a730c292f59f3a7193a7e42ab538275e891d9 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Wed, 3 Apr 2019 17:05:25 +0530 Subject: [PATCH] logs: remove '\n' in LOG() usage Signed-off-by: Prasanna Kumar Kalever --- cli/gluster-block.c | 10 +++++----- utils/dyn-config.c | 30 +++++++++++++++--------------- utils/lru.c | 4 ++-- utils/utils.c | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cli/gluster-block.c b/cli/gluster-block.c index d4c6f99..7372043 100644 --- a/cli/gluster-block.c +++ b/cli/gluster-block.c @@ -65,19 +65,19 @@ glusterBlockCLILoadConfig(void) if (GB_ALLOC(cfg) < 0) { LOG("cli", GB_LOG_ERROR, - "Alloc GB config failed for configPath: %s!\n", GB_DEF_CONFIGPATH); + "Alloc GB config failed for configPath: %s!", GB_DEF_CONFIGPATH); return NULL; } if (GB_STRDUP(cfg->configPath, GB_DEF_CONFIGPATH) < 0) { LOG("cli", GB_LOG_ERROR, - "failed to copy configPath: %s\n", GB_DEF_CONFIGPATH); + "failed to copy configPath: %s", GB_DEF_CONFIGPATH); goto freeConfig; } if (glusterBlockLoadConfig(cfg, false)) { LOG("cli", GB_LOG_ERROR, - "Loading GB config failed for configPath: %s!\n", GB_DEF_CONFIGPATH); + "Loading GB config failed for configPath: %s!", GB_DEF_CONFIGPATH); goto freeConfigPath; } @@ -154,7 +154,7 @@ glusterBlockCliRPC_1(void *cobj, clioperations opt) if (!conf) { LOG("cli", GB_LOG_ERROR, "glusterBlockCLILoadConfig() failed, for block %s create on volume %s" - " with hosts %s\n", create_obj->block_name, create_obj->volume, + " with hosts %s", create_obj->block_name, create_obj->volume, create_obj->block_hosts); goto out; } @@ -175,7 +175,7 @@ glusterBlockCliRPC_1(void *cobj, clioperations opt) create_obj = cobj; if (block_create_cli_1(create_obj, &reply, clnt) != RPC_SUCCESS) { LOG("cli", GB_LOG_ERROR, - "%s block %s create on volume %s with hosts %s failed\n", + "%s block %s create on volume %s with hosts %s failed", clnt_sperror(clnt, "block_create_cli_1"), create_obj->block_name, create_obj->volume, create_obj->block_hosts); goto out; diff --git a/utils/dyn-config.c b/utils/dyn-config.c index fc4cb08..886be19 100644 --- a/utils/dyn-config.c +++ b/utils/dyn-config.c @@ -254,7 +254,7 @@ glusterBlockReadConfig(gbConfig *cfg, ssize_t *len) } if (fp == NULL) { LOG("mgmt", GB_LOG_ERROR, - "Failed to open file '%s'\n", cfg->configPath); + "Failed to open file '%s'", cfg->configPath); GB_FREE(buf); return NULL; } @@ -429,7 +429,7 @@ glusterBlockParseOption(char **cur, const char *end) break; default: LOG("mgmt", GB_LOG_ERROR, - "option type %d not supported!\n", option->type); + "option type %d not supported!", option->type); break; } } @@ -459,7 +459,7 @@ glusterBlockLoadConfig(gbConfig *cfg, bool reloading) buf = glusterBlockReadConfig(cfg, &len); if (buf == NULL) { LOG("mgmt", GB_LOG_ERROR, - "Failed to read file '%s'\n", cfg->configPath); + "Failed to read file '%s'", cfg->configPath); return -1; } @@ -484,7 +484,7 @@ glusterBlockDynConfigStart(void *arg) monitor = inotify_init(); if (monitor == -1) { LOG("mgmt", GB_LOG_ERROR, - "Failed to init inotify %d\n", monitor); + "Failed to init inotify %d", monitor); return NULL; } @@ -500,24 +500,24 @@ glusterBlockDynConfigStart(void *arg) wd = inotify_add_watch(monitor, GB_DEF_CONFIGDIR, IN_MODIFY); if (wd == -1) { LOG("mgmt", GB_LOG_ERROR, - "Failed to add \"%s\" to inotify (%d)\n", GB_DEF_CONFIGDIR, monitor); + "Failed to add \"%s\" to inotify (%d)", GB_DEF_CONFIGDIR, monitor); return NULL; } LOG("mgmt", GB_LOG_INFO, - "Inotify is watching \"%s\", wd: %d, mask: IN_MODIFY\n", GB_DEF_CONFIGDIR, wd); + "Inotify is watching \"%s\", wd: %d, mask: IN_MODIFY", GB_DEF_CONFIGDIR, wd); while (1) { len = read(monitor, buf, GB_BUF_LEN); if (len == -1) { - LOG("mgmt", GB_LOG_WARNING, "Failed to read inotify: %d\n", len); + LOG("mgmt", GB_LOG_WARNING, "Failed to read inotify: %d", len); continue; } for (p = buf; p < buf + len; p += sizeof(*event) + event->len) { event = (struct inotify_event *)p; - LOG("mgmt", GB_LOG_INFO, "event->mask: 0x%x\n", event->mask); + LOG("mgmt", GB_LOG_INFO, "event->mask: 0x%x", event->mask); if (event->wd != wd) { continue; @@ -557,17 +557,17 @@ glusterBlockSetupConfig(const char *configPath) } if (GB_ALLOC(cfg) < 0) { - LOG("mgmt", GB_LOG_ERROR, "Alloc GB config failed for configPath: %s!\n", configPath); + LOG("mgmt", GB_LOG_ERROR, "Alloc GB config failed for configPath: %s!", configPath); return NULL; } if (GB_STRDUP(cfg->configPath, configPath) < 0) { - LOG("mgmt", GB_LOG_ERROR, "failed to copy configPath: %s\n", configPath); + LOG("mgmt", GB_LOG_ERROR, "failed to copy configPath: %s", configPath); goto freeConfig; } if (glusterBlockLoadConfig(cfg, false)) { - LOG("mgmt", GB_LOG_ERROR, "Loading GB config failed for configPath: %s!\n", configPath); + LOG("mgmt", GB_LOG_ERROR, "Loading GB config failed for configPath: %s!", configPath); goto freeConfigPath; } @@ -578,7 +578,7 @@ glusterBlockSetupConfig(const char *configPath) ret = pthread_create(&cfg->threadId, NULL, glusterBlockDynConfigStart, cfg); if (ret) { LOG("mgmt", GB_LOG_WARNING, - "Dynamic config started failed, fallling back to static %d!\n", ret); + "Dynamic config started failed, fallling back to static %d!", ret); } else { cfg->isDynamic = true; } @@ -602,18 +602,18 @@ glusterBlockCancelConfigThread(gbConfig *cfg) ret = pthread_cancel(threadId); if (ret) { - LOG("mgmt", GB_LOG_ERROR, "pthread_cancel failed with value %d\n", ret); + LOG("mgmt", GB_LOG_ERROR, "pthread_cancel failed with value %d", ret); return; } ret = pthread_join(threadId, &join_retval); if (ret) { - LOG("mgmt", GB_LOG_ERROR, "pthread_join failed with value %d\n", ret); + LOG("mgmt", GB_LOG_ERROR, "pthread_join failed with value %d", ret); return; } if (join_retval != PTHREAD_CANCELED) { - LOG("mgmt", GB_LOG_ERROR, "unexpected join retval: %p\n", join_retval); + LOG("mgmt", GB_LOG_ERROR, "unexpected join retval: %p", join_retval); } } diff --git a/utils/lru.c b/utils/lru.c index 05df896..f34c800 100644 --- a/utils/lru.c +++ b/utils/lru.c @@ -29,7 +29,7 @@ glusterBlockSetLruCount(const size_t lruCount) MSG(stderr, "glfsLruCount should be [0 < COUNT < %d]\n", LRU_COUNT_MAX); LOG("mgmt", GB_LOG_ERROR, - "glfsLruCount should be [0 < COUNT < %d]\n", + "glfsLruCount should be [0 < COUNT < %d]", LRU_COUNT_MAX); return -1; } @@ -39,7 +39,7 @@ glusterBlockSetLruCount(const size_t lruCount) UNLOCK(gbConf.lock); LOG("mgmt", GB_LOG_CRIT, - "glfsLruCount now is %lu\n", lruCount); + "glfsLruCount now is %lu", lruCount); return 0; } diff --git a/utils/utils.c b/utils/utils.c index 85cf56d..97a0b74 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -45,7 +45,7 @@ glusterBlockSetLogLevel(unsigned int logLevel) gbConf.logLevel = logLevel; UNLOCK(gbConf.lock); LOG("mgmt", GB_LOG_CRIT, - "logLevel now is %s\n", LogLevelLookup[logLevel]); + "logLevel now is %s", LogLevelLookup[logLevel]); return 0; } -- 2.14.3