logtoserial can now take strings

This commit is contained in:
K. Lange 2018-06-26 16:58:31 +09:00
parent 7bd5c716b3
commit 8c3d99da3c
1 changed files with 15 additions and 1 deletions

View File

@ -203,7 +203,21 @@ static int serial_mount_devices(void) {
char * c;
if ((c = args_value("logtoserial"))) {
debug_file = ttyS0;
debug_level = atoi(c);
if (!strcmp(c,"INFO") || !strcmp(c,"info")) {
debug_level = INFO;
} else if (!strcmp(c,"NOTICE") || !strcmp(c,"notice")) {
debug_level = NOTICE;
} else if (!strcmp(c,"WARNING") || !strcmp(c,"warning")) {
debug_level = WARNING;
} else if (!strcmp(c,"ERROR") || !strcmp(c,"error")) {
debug_level = ERROR;
} else if (!strcmp(c,"CRITICAL") || !strcmp(c,"critical")) {
debug_level = CRITICAL;
} else if (!strcmp(c,"INSANE") || !strcmp(c,"insane")) {
debug_level = INSANE;
} else {
debug_level = atoi(c);
}
debug_print(NOTICE, "Serial logging enabled at level %d.", debug_level);
}