From e11483012460fd3654bd0a3640755f581d3fecf4 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 6 Jun 2014 15:00:08 +1000 Subject: ctdb-common: Keep debug level related functions with logging code Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/common/ctdb_logging.c | 40 ++++++++++++++++++++++++++++++++++++++++ ctdb/common/ctdb_util.c | 40 ---------------------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/ctdb/common/ctdb_logging.c b/ctdb/common/ctdb_logging.c index ba3e8610c5d..baaf7007993 100644 --- a/ctdb/common/ctdb_logging.c +++ b/ctdb/common/ctdb_logging.c @@ -23,6 +23,9 @@ #include "../include/ctdb_private.h" #include "../include/ctdb_client.h" +int LogLevel = DEBUG_NOTICE; +int this_log_level = 0; + int log_ringbuf_size; #define MAX_LOG_SIZE 128 @@ -198,3 +201,40 @@ int32_t ctdb_control_clear_log(struct ctdb_context *ctdb) return 0; } + +struct debug_levels debug_levels[] = { + {DEBUG_EMERG, "EMERG"}, + {DEBUG_ALERT, "ALERT"}, + {DEBUG_CRIT, "CRIT"}, + {DEBUG_ERR, "ERR"}, + {DEBUG_WARNING, "WARNING"}, + {DEBUG_NOTICE, "NOTICE"}, + {DEBUG_INFO, "INFO"}, + {DEBUG_DEBUG, "DEBUG"}, + {0, NULL} +}; + +const char *get_debug_by_level(int32_t level) +{ + int i; + + for (i=0; debug_levels[i].description != NULL; i++) { + if (debug_levels[i].level == level) { + return debug_levels[i].description; + } + } + return "Unknown"; +} + +int32_t get_debug_by_desc(const char *desc) +{ + int i; + + for (i=0; debug_levels[i].description != NULL; i++) { + if (!strcasecmp(debug_levels[i].description, desc)) { + return debug_levels[i].level; + } + } + + return DEBUG_ERR; +} diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 579c1c174cb..cd7b4d70498 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -25,9 +25,6 @@ #include "system/shmem.h" #include "../include/ctdb_private.h" -int LogLevel = DEBUG_NOTICE; -int this_log_level = 0; - /* return error string for last error */ @@ -407,43 +404,6 @@ unsigned ctdb_addr_to_port(ctdb_sock_addr *addr) return 0; } -struct debug_levels debug_levels[] = { - {DEBUG_EMERG, "EMERG"}, - {DEBUG_ALERT, "ALERT"}, - {DEBUG_CRIT, "CRIT"}, - {DEBUG_ERR, "ERR"}, - {DEBUG_WARNING, "WARNING"}, - {DEBUG_NOTICE, "NOTICE"}, - {DEBUG_INFO, "INFO"}, - {DEBUG_DEBUG, "DEBUG"}, - {0, NULL} -}; - -const char *get_debug_by_level(int32_t level) -{ - int i; - - for (i=0; debug_levels[i].description != NULL; i++) { - if (debug_levels[i].level == level) { - return debug_levels[i].description; - } - } - return "Unknown"; -} - -int32_t get_debug_by_desc(const char *desc) -{ - int i; - - for (i=0; debug_levels[i].description != NULL; i++) { - if (!strcasecmp(debug_levels[i].description, desc)) { - return debug_levels[i].level; - } - } - - return DEBUG_ERR; -} - /* we don't lock future pages here; it would increase the chance that * we'd fail to mmap later on. */ void ctdb_lockdown_memory(struct ctdb_context *ctdb) -- cgit