Use common loglevel JSON parser.

This now means we can ask for IO logs for peers, too (that case was missing!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-02-05 14:39:28 +10:30
parent b7acd93578
commit e2eb694619
3 changed files with 22 additions and 18 deletions

View File

@@ -944,15 +944,7 @@ static void json_listpeers(struct command *cmd,
}
if (leveltok) {
gpa->ll = tal(gpa, enum log_level);
if (json_tok_streq(buffer, leveltok, "debug"))
*gpa->ll = LOG_DBG;
else if (json_tok_streq(buffer, leveltok, "info"))
*gpa->ll = LOG_INFORM;
else if (json_tok_streq(buffer, leveltok, "unusual"))
*gpa->ll = LOG_UNUSUAL;
else if (json_tok_streq(buffer, leveltok, "broken"))
*gpa->ll = LOG_BROKEN;
else {
if (!json_tok_loglevel(buffer, leveltok, gpa->ll)) {
command_fail(cmd, "Invalid level param");
return;
}