From: Amitay Isaacs Date: Wed, 11 Nov 2015 22:15:08 +0000 (+1100) Subject: ctdb-logging: Allow numeric specification of debug level X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=3d8c1ca80aab82823b7cf9360cdc742e80a86e8f;p=obnox%2Fsamba%2Fsamba-obnox.git ctdb-logging: Allow numeric specification of debug level This makes the function compatible with parse_debug(). Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke Reviewed-by: Michael Adam --- diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c index cc8e5b2c04b..f2304715c8d 100644 --- a/ctdb/common/logging.c +++ b/ctdb/common/logging.c @@ -18,6 +18,7 @@ */ #include +#include #include "common/logging.h" @@ -36,6 +37,16 @@ bool debug_level_parse(const char *log_string, enum debug_level *log_level) { int i; + if (isdigit(log_string[0])) { + int level = atoi(log_string); + + if (level >= 0 && level < ARRAY_SIZE(log_string_map)) { + *log_level = debug_level_from_int(level); + return true; + } + return false; + } + for (i=0; i