diff options
author | Amitay Isaacs <amitay@gmail.com> | 2014-06-06 15:00:08 +1000 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2014-06-12 05:40:10 +0200 |
commit | e11483012460fd3654bd0a3640755f581d3fecf4 (patch) | |
tree | 23efd45b8f9f66d5bd114b13e080db9253e9d182 | |
parent | d09f8134c1a915ec59c502769b72a84d43a5c577 (diff) | |
download | samba-e11483012460fd3654bd0a3640755f581d3fecf4.tar.gz samba-e11483012460fd3654bd0a3640755f581d3fecf4.tar.xz samba-e11483012460fd3654bd0a3640755f581d3fecf4.zip |
ctdb-common: Keep debug level related functions with logging code
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
-rw-r--r-- | ctdb/common/ctdb_logging.c | 40 | ||||
-rw-r--r-- | 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 ba3e8610c5..baaf700799 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 579c1c174c..cd7b4d7049 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) |