1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb-logging: Allow numeric specification of debug level

This makes the function compatible with parse_debug().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Amitay Isaacs 2015-11-12 09:15:08 +11:00 committed by Martin Schwenke
parent 2ddc5274ba
commit 3d8c1ca80a

View File

@ -18,6 +18,7 @@
*/
#include <replace.h>
#include <system/locale.h>
#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<ARRAY_SIZE(log_string_map); i++) {
if (strncasecmp(log_string_map[i].log_string,
log_string, strlen(log_string)) == 0) {