mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
write logfile logs earlier, shorten startup banner, add uptime to logfile (#1443)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
@@ -164,7 +164,9 @@ void ClassLogFile::WriteToDedicatedFile(std::string _fn, esp_log_level_t level,
|
||||
break;
|
||||
}
|
||||
|
||||
logline = logline + "\t<" + loglevelString + ">\t" + message.c_str() + "\n";
|
||||
char uptime[20];
|
||||
snprintf(uptime, sizeof(uptime), "%8d", (uint32_t)(esp_timer_get_time()/1000/1000)); // in seconds
|
||||
logline = "[" + std::string(uptime) + "] " + logline + "\t<" + loglevelString + ">\t" + message + "\n";
|
||||
fputs(logline.c_str(), pFile);
|
||||
fclose(pFile);
|
||||
} else {
|
||||
|
||||
@@ -170,26 +170,16 @@ extern "C" void app_main(void)
|
||||
string versionFormated = "Tag: '" + std::string(GIT_TAG) + "', " + versionFormated;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "=============================================================================================");
|
||||
ESP_LOGD(TAG, "%s", versionFormated.c_str());
|
||||
ESP_LOGD(TAG, "=============================================================================================");
|
||||
ESP_LOGD(TAG, "Reset reason: %s", getResetReason().c_str());
|
||||
|
||||
LogFile.CreateLogDirectories();
|
||||
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "==================== Startup ====================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, versionFormated);
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Reset reason: " + getResetReason());
|
||||
|
||||
CheckOTAUpdate();
|
||||
|
||||
LogFile.CreateLogDirectories();
|
||||
CheckUpdate();
|
||||
/*
|
||||
int mk_ret = mkdir("/sdcard/new_fd_mkdir", 0775);
|
||||
ESP_LOGI(TAG, "mkdir ret %d", mk_ret);
|
||||
mk_ret = mkdir("/sdcard/new_fd_mkdir/test", 0775);
|
||||
ESP_LOGI(TAG, "mkdir ret %d", mk_ret);
|
||||
MakeDir("/sdcard/test2");
|
||||
MakeDir("/sdcard/test2/intern");
|
||||
*/
|
||||
|
||||
|
||||
char *ssid = NULL, *passwd = NULL, *hostname = NULL, *ip = NULL, *gateway = NULL, *netmask = NULL, *dns = NULL;
|
||||
LoadWlanFromFile("/sdcard/wlan.ini", ssid, passwd, hostname, ip, gateway, netmask, dns);
|
||||
@@ -229,11 +219,9 @@ extern "C" void app_main(void)
|
||||
|
||||
setBootTime();
|
||||
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=============================================================================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================== Main Started ============================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=============================================================================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, versionFormated);
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Reset reason: " + getResetReason());
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "================== Main Started =================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
||||
|
||||
if (getHTMLcommit() != std::string(GIT_REV)) {
|
||||
LogFile.WriteToFile(ESP_LOG_WARN, TAG, std::string("Web UI version (") + getHTMLcommit() + ") does not match firmware version (" + std::string(GIT_REV) + ") !");
|
||||
|
||||
@@ -1268,7 +1268,7 @@ textarea {
|
||||
<input type="number" id="AutoTimer_Intervall_value1" size="13" min="3" step="any">
|
||||
</td>
|
||||
<td style="font-size: 80%;">
|
||||
Interval in which the number(s) are read (in minutes). If a run takes longer than this interval, the next run gets postponed until the current run completes.
|
||||
Interval in which the number(s) are read (in minutes). If a digitalization round takes longer than this interval, the next run gets postponed until the current run completes.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
|
||||
|
||||
function processLogLine(line, index, arr) {
|
||||
/* Make sure the whitespaces in the uptime field get persevered */
|
||||
uptimePart = line.slice(0, line.indexOf("]")).replace(/ /g, " ");
|
||||
line = uptimePart + line.slice(line.indexOf("]"))
|
||||
|
||||
if (line.includes("<WRN>")) {
|
||||
arr[index] = "<span style=\"color:#e83c00\">" + line + "</span>";
|
||||
}
|
||||
@@ -66,6 +70,9 @@
|
||||
else if (line.includes("<DBG>")) {
|
||||
arr[index] = "<span style=\"color:gray\">" + line + "</span>";
|
||||
}
|
||||
else {
|
||||
arr[index] = line;
|
||||
}
|
||||
|
||||
arr[index] += "<br>";
|
||||
}
|
||||
@@ -80,7 +87,8 @@
|
||||
return res.text();
|
||||
})
|
||||
.then((log) => {
|
||||
log = log.replace(/</g, "<").replace(/>/g, ">");
|
||||
log = log.replace(/</g, "<");
|
||||
log = log.replace(/>/g, ">");
|
||||
logArr = log.split("\n");
|
||||
logArr.forEach(processLogLine);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user