From 2d512b278e5905964c1294c587ba405678c3d10c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 7 Nov 2018 14:14:05 +0100 Subject: debug: Use debuglevel_(get|set) function Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Thu Nov 8 11:03:11 CET 2018 on sn-devel-144 --- ctdb/common/conf_tool.c | 6 ++++-- ctdb/common/logging.c | 4 +++- ctdb/common/path_tool.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'ctdb/common') diff --git a/ctdb/common/conf_tool.c b/ctdb/common/conf_tool.c index e6020c504e6..8e0753eb787 100644 --- a/ctdb/common/conf_tool.c +++ b/ctdb/common/conf_tool.c @@ -276,6 +276,7 @@ int main(int argc, const char **argv) TALLOC_CTX *mem_ctx; struct conf_tool_context *ctx; int ret, result; + int level; bool ok; mem_ctx = talloc_new(NULL); @@ -297,10 +298,11 @@ int main(int argc, const char **argv) } setup_logging("ctdb-config", DEBUG_STDERR); - ok = debug_level_parse(conf_data.debug, &DEBUGLEVEL); + ok = debug_level_parse(conf_data.debug, &level); if (!ok) { - DEBUGLEVEL = DEBUG_ERR; + level = DEBUG_ERR; } + debuglevel_set(level); ret = conf_tool_run(ctx, &result); if (ret != 0) { diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c index dc8c4f75058..aaa93216ef5 100644 --- a/ctdb/common/logging.c +++ b/ctdb/common/logging.c @@ -674,6 +674,7 @@ int logging_init(TALLOC_CTX *mem_ctx, const char *logging, { struct log_backend *backend = NULL; char *option = NULL; + int level; int ret; setup_logging(app_name, DEBUG_STDERR); @@ -681,9 +682,10 @@ int logging_init(TALLOC_CTX *mem_ctx, const char *logging, if (debug_level == NULL) { debug_level = getenv("CTDB_DEBUGLEVEL"); } - if (! debug_level_parse(debug_level, &DEBUGLEVEL)) { + if (! debug_level_parse(debug_level, &level)) { return EINVAL; } + debuglevel_set(level); if (logging == NULL) { logging = getenv("CTDB_LOGGING"); diff --git a/ctdb/common/path_tool.c b/ctdb/common/path_tool.c index 1c60b023c42..a19afa9b0c3 100644 --- a/ctdb/common/path_tool.c +++ b/ctdb/common/path_tool.c @@ -365,7 +365,7 @@ int main(int argc, const char **argv) } setup_logging("ctdb-path", DEBUG_STDERR); - DEBUGLEVEL = DEBUG_ERR; + debuglevel_set(DEBUG_ERR); ret = path_tool_run(ctx, &result); if (ret != 0) { -- cgit v1.2.1