Adds ASCII log option needed by portudino (#4443)

* Adds ASCII logs useful to portudino

Activates ASCII log option when stdout is not a terminal.  This is
generally the right thing to do; if not, the behavior can be
overridden in config.yaml using AsciiLogs under Logging.  The result
is reasonable system logs for portudino when running under systemd or
the like.

Signed-off-by: Christopher Hoover <ch@murgatroid.com>
This commit is contained in:
Christopher Hoover
2024-08-15 17:09:06 -07:00
committed by GitHub
parent d398419aef
commit 85176756ec
5 changed files with 76 additions and 23 deletions

View File

@@ -99,6 +99,7 @@ void portduinoSetup()
settingsStrings[spidev] = "";
settingsStrings[displayspidev] = "";
settingsMap[spiSpeed] = 2000000;
settingsMap[ascii_logs] = !isatty(1);
YAML::Node yamlConfig;
@@ -152,6 +153,10 @@ void portduinoSetup()
settingsMap[logoutputlevel] = level_error;
}
settingsStrings[traceFilename] = yamlConfig["Logging"]["TraceFile"].as<std::string>("");
if (yamlConfig["Logging"]["AsciiLogs"]) {
// Default is !isatty(1) but can be set explicitly in config.yaml
settingsMap[ascii_logs] = yamlConfig["Logging"]["AsciiLogs"].as<bool>();
}
}
if (yamlConfig["Lora"]) {
settingsMap[use_sx1262] = false;