ctdb-tool: Use new debug level API
authorAmitay Isaacs <amitay@gmail.com>
Wed, 11 Nov 2015 05:40:41 +0000 (16:40 +1100)
committerMartin Schwenke <martins@samba.org>
Sun, 15 Nov 2015 23:46:15 +0000 (00:46 +0100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/tools/ctdb.c

index 5fb1ef456d4cce93c9a33cf5aa1d03b6dbb2dde1..5874df2b35da2d161e55f919511d6cb7bc8bc620 100644 (file)
@@ -37,7 +37,6 @@
 #include "lib/util/substitute.h"
 #include "lib/util/time.h"
 
-#include "ctdb_logging.h"
 #include "ctdb_version.h"
 #include "ctdb_private.h"
 #include "ctdb_client.h"
@@ -46,6 +45,7 @@
 #include "common/rb_tree.h"
 #include "common/system.h"
 #include "common/common.h"
+#include "common/logging.h"
 
 #define ERR_TIMEOUT    20      /* timed out trying to reach node */
 #define ERR_NONODE     21      /* node does not exist */
@@ -4883,7 +4883,8 @@ static int control_getdebug(struct ctdb_context *ctdb, int argc, const char **ar
                DEBUG(DEBUG_ERR, ("Unable to get debuglevel response from node %u\n", options.pnn));
                return ret;
        } else {
-               const char *desc = get_debug_by_level(level);
+               enum debug_level log_level = debug_level_from_int(level);
+               const char *desc = debug_level_to_string(log_level);
                if (desc == NULL) {
                        /* This should never happen */
                        desc = "Unknown";
@@ -5045,19 +5046,22 @@ static int control_setdebug(struct ctdb_context *ctdb, int argc, const char **ar
 {
        int ret;
        int32_t level;
+       enum debug_level log_level;
 
        if (argc == 0) {
                printf("You must specify the debug level. Valid levels are:\n");
-               print_debug_levels(stdout);
+               printf("\tERROR | WARNING | NOTICE | INFO | DEBUG\n");
                return 0;
        }
 
-       if (!parse_debug(argv[0], &level)) {
+       if (!debug_level_parse(argv[0], &log_level)) {
                printf("Invalid debug level, must be one of\n");
-               print_debug_levels(stdout);
+               printf("\tERROR | WARNING | NOTICE | INFO | DEBUG\n");
                return -1;
        }
 
+       level = debug_level_to_int(log_level);
+
        ret = ctdb_ctrl_set_debuglevel(ctdb, options.pnn, level);
        if (ret != 0) {
                DEBUG(DEBUG_ERR, ("Unable to set debug level on node %u\n", options.pnn));