dynamically show log levels

This commit is contained in:
proddy
2020-08-14 10:11:19 +02:00
parent 4dc61dfa3c
commit 753bbef816
2 changed files with 9 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ void EMSESPShell::display_banner() {
#if defined(EMSESP_STANDALONE) #if defined(EMSESP_STANDALONE)
#ifdef RUN_TEST #ifdef RUN_TEST
invoke_command("test"); // "test default" invoke_command("test"); // same as "test default"
#endif #endif
#endif #endif
} }
@@ -324,7 +324,14 @@ void Console::load_standard_commands(unsigned int context) {
return; return;
} }
} else { } else {
shell.printfln(F_(log_level_list)); shell.print(F("levels: "));
std::vector<std::string> v = uuid::log::levels_lowercase();
size_t i = v.size();
while (i--) {
shell.printf(v[i].c_str());
shell.print(' ');
}
shell.println();
} }
shell.printfln(F_(log_level_fmt), uuid::log::format_level_uppercase(shell.log_level())); shell.printfln(F_(log_level_fmt), uuid::log::format_level_uppercase(shell.log_level()));
}, },

View File

@@ -110,7 +110,6 @@ MAKE_PSTR(typeid_mandatory, "<type ID>")
MAKE_PSTR(deviceid_mandatory, "<device ID>") MAKE_PSTR(deviceid_mandatory, "<device ID>")
MAKE_PSTR(deviceid_optional, "[device ID]") MAKE_PSTR(deviceid_optional, "[device ID]")
MAKE_PSTR(invalid_log_level, "Invalid log level") MAKE_PSTR(invalid_log_level, "Invalid log level")
MAKE_PSTR(log_level_list,"OFF EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG TRACE ALL")
MAKE_PSTR(log_level_fmt, "Log level = %s") MAKE_PSTR(log_level_fmt, "Log level = %s")
MAKE_PSTR(log_level_optional, "[level]") MAKE_PSTR(log_level_optional, "[level]")
MAKE_PSTR(name_mandatory, "<name>") MAKE_PSTR(name_mandatory, "<name>")