ctdb-common: Use new debug level API
authorAmitay Isaacs <amitay@gmail.com>
Wed, 11 Nov 2015 04:19:41 +0000 (15:19 +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/common/cmdline.c

index 69e82314dd79dc8477ace8fabc8496ab46d59058..02083e88838a397ef91086f01ee3a10203a04928 100644 (file)
 #include <ctype.h>
 
 #include "lib/util/debug.h"
-#include "ctdb_logging.h"
 #include "ctdb_private.h"
 #include "ctdb_client.h"
 
 #include "common/rb_tree.h"
 #include "common/common.h"
+#include "common/logging.h"
 #include "common/cmdline.h"
 
 
@@ -81,6 +81,7 @@ struct poptOption popt_ctdb_cmdline[] = {
 struct ctdb_context *ctdb_cmdline_init(struct tevent_context *ev)
 {
        struct ctdb_context *ctdb;
+       enum debug_level log_level;
        int ret;
 
        /* initialise ctdb */
@@ -106,8 +107,10 @@ struct ctdb_context *ctdb_cmdline_init(struct tevent_context *ev)
        }
 
        /* Set the debug level */
-       if (!parse_debug(ctdb_cmdline.debuglevel, &DEBUGLEVEL)) {
-               DEBUGLEVEL = DEBUG_NOTICE;
+       if (debug_level_parse(ctdb_cmdline.debuglevel, &log_level)) {
+               DEBUGLEVEL = debug_level_to_int(log_level);
+       } else {
+               DEBUGLEVEL = debug_level_to_int(DEBUG_NOTICE);
        }
 
        /* set up the tree to store server ids */
@@ -124,6 +127,7 @@ struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
                                         struct timeval req_timeout)
 {
        struct ctdb_context *ctdb;
+       enum debug_level log_level;
        char *socket_name;
        int ret;
 
@@ -155,8 +159,10 @@ struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
        }
 
        /* Set the debug level */
-       if (!parse_debug(ctdb_cmdline.debuglevel, &DEBUGLEVEL)) {
-               DEBUGLEVEL = DEBUG_NOTICE;
+       if (debug_level_parse(ctdb_cmdline.debuglevel, &log_level)) {
+               DEBUGLEVEL = debug_level_to_int(log_level);
+       } else {
+               DEBUGLEVEL = debug_level_to_int(DEBUG_NOTICE);
        }
 
        ret = ctdb_socket_connect(ctdb);