ctdb-logging: Remove debug levels DEBUG_ALERT and DEBUG_CRIT
authorMartin Schwenke <martin@meltin.net>
Wed, 8 Oct 2014 03:22:53 +0000 (14:22 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 28 Oct 2014 04:42:04 +0000 (05:42 +0100)
Internally map them to DEBUG_ERR to limit code churn.

This reduces the unwieldy number of debug levels used by CTDB.  ALERT
and CRIT aren't of much use as separate errors, since everything from
ERR up should always be logged.  In future just ERR can be used.

This also improves compatibility with Samba's debug.c system priority
mapping.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/ctdb_logging.c
ctdb/doc/ctdb.1.xml
ctdb/doc/ctdb.7.xml
ctdb/include/ctdb_logging.h
ctdb/server/ctdb_logging.c
ctdb/tests/simple/13_ctdb_setdebug.sh

index f6d8df757a90c5171530b9d1f6abe9e7863ba304..c79397d03f053d380689be04b76ef2abec7643fd 100644 (file)
@@ -26,8 +26,6 @@
 const char *debug_extra = "";
 
 struct debug_levels debug_levels[] = {
-       {DEBUG_ALERT,   "ALERT"},
-       {DEBUG_CRIT,    "CRIT"},
        {DEBUG_ERR,     "ERR"},
        {DEBUG_WARNING, "WARNING"},
        {DEBUG_NOTICE,  "NOTICE"},
index 7e12c7a06e2eb08cc73a74456890bf51dec790bc..170d05a9fa1890e8cc8f5308c3e4cd22a38c161d 100644 (file)
@@ -902,7 +902,7 @@ DB Statistics: locking.tdb
        The list of debug levels from highest to lowest are :
       </para>
       <para>
-       ALERT CRIT ERR WARNING NOTICE INFO DEBUG
+       ERR WARNING NOTICE INFO DEBUG
       </para>
     </refsect2>
 
@@ -912,7 +912,7 @@ DB Statistics: locking.tdb
        Set the debug level of a node. This controls what information will be logged.
       </para>
       <para>
-       The debuglevel is one of ALERT CRIT ERR WARNING NOTICE INFO DEBUG
+       The debuglevel is one of ERR WARNING NOTICE INFO DEBUG
       </para>
     </refsect2>
 
index 61b58828deb5d0ebefba1b2732a407bec75c2a52..b54fa4267b1a1722d1a596ea6edbd48b2f03ca94 100644 (file)
@@ -883,8 +883,6 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
     </para>
 
     <simplelist>
-      <member>ALERT (-2)</member>
-      <member>CRIT (-1)</member>
       <member>ERR (0)</member>
       <member>WARNING (1)</member>
       <member>NOTICE (2)</member>
index 1fd6123991369a2305ac73ff04ccfe4d72ecacd9..6faf3d947bbed3737bbf3b7264435311f1853946 100644 (file)
@@ -23,8 +23,6 @@
 extern const char *debug_extra;
 
 enum debug_level {
-       DEBUG_ALERT   = -2,
-       DEBUG_CRIT    = -1,
        DEBUG_ERR     =  0,
        DEBUG_WARNING =  1,
        DEBUG_NOTICE  =  2,
@@ -32,4 +30,8 @@ enum debug_level {
        DEBUG_DEBUG   =  4,
 };
 
+/* These are used in many places, so define them here to avoid churn */
+#define DEBUG_ALERT DEBUG_ERR
+#define        DEBUG_CRIT  DEBUG_ERR
+
 #endif /* _CTDB_LOGGING_H_ */
index b1e53cf62808c67aa3d40b30c1292c7547b37154..25d27225880e643b9d30b57132c81ae0faeb6806 100644 (file)
@@ -218,12 +218,6 @@ static void ctdb_syslog_log(void *private_ptr, int dbglevel, const char *s)
        struct sockaddr_in syslog_sin;
 
        switch (dbglevel) {
-       case DEBUG_ALERT: 
-               level = LOG_ALERT; 
-               break;
-       case DEBUG_CRIT: 
-               level = LOG_CRIT; 
-               break;
        case DEBUG_ERR: 
                level = LOG_ERR; 
                break;
index e4a03d5e74362e5b738844c28cbd98648033e49e..ef8b3eef41e1d86204508182a40ae83e9ad57aa3 100755 (executable)
@@ -53,7 +53,7 @@ set_and_check_debug ()
 get_debug $test_node
 initial_debug="$check_debug"
 
-levels="ALERT CRIT ERR WARNING NOTICE INFO DEBUG"
+levels="ERR WARNING NOTICE INFO DEBUG"
 
 for new_debug in $levels ; do
     [ "$initial_debug" != "$new_debug" ] || continue