запись лога в файл

This commit is contained in:
Dmitry Borisenko
2022-08-24 00:21:20 +02:00
parent 875b7616ab
commit 5deb974b4e
4 changed files with 22 additions and 15 deletions

View File

@@ -14,7 +14,7 @@
"mqttPrefix": "/rise",
"mqttUser": "rise",
"mqttPass": "3hostel3",
"serverip": "http://206.189.49.244:8081",
"serverip": "http://157.245.22.57:8081",
"log": 0,
"mqttin": 0
}

View File

@@ -15,7 +15,7 @@
"mqttPrefix": "/rise",
"mqttUser": "rise",
"mqttPass": "3hostel3",
"serverip": "http://206.189.49.244:8081",
"serverip": "http://157.245.22.57:8081",
"log": 0,
"mqttin": 0
},

View File

@@ -43,12 +43,16 @@ void standWebServerInit() {
HTTP.send(200, "text/plain", "ok");
});
HTTP.on("/log.txt", HTTP_GET, []() {
HTTP.send(200, "text/plain", readFile(F("log.txt"), 20000));
});
// Добавляем функцию Update для перезаписи прошивки по WiFi при 1М(256K FileFS) и выше
// httpUpdater.setup(&HTTP);
// Запускаем HTTP сервер
HTTP.begin();
//#ifdef REST_FILE_OPERATIONS
//#ifdef REST_FILE_OPERATIONS
// SPIFFS.begin();
// {
// Dir dir = SPIFFS.openDir("/");
@@ -88,11 +92,12 @@ void standWebServerInit() {
HTTP.on("/edit", HTTP_DELETE, handleFileDelete);
//Изменение файла
HTTP.on("/edit", HTTP_POST, []() {
HTTP.on(
"/edit", HTTP_POST, []() {
HTTP.send(200, "text/plain", "");
},
handleFileUpload);
//#endif
//#endif
// called when the url is not defined here
HTTP.onNotFound([]() {

View File

@@ -21,6 +21,8 @@ class Loging : public IoTItem {
SerialPrint("E", F("Logging"), F("no value set"));
} else {
regEvent(value, "Logging");
String logData = String(_time_local.second) + " " + value + "\r\n";
writeFile("log.txt", logData);
}
}
};