added log level to logfile, adjusted some loglevels

This commit is contained in:
George Ruinelli
2022-10-22 18:05:08 +02:00
parent 0a2b6b71ca
commit 1e698440f9
22 changed files with 138 additions and 114 deletions

View File

@@ -264,7 +264,7 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const
static esp_err_t logfileact_get_handler(httpd_req_t *req)
{
LogFile.WriteToFile("logfileact_get_handler");
LogFile.WriteToFile(ESP_LOG_DEBUG, "logfileact_get_handler");
char filepath[FILE_PATH_MAX];
FILE *fd = NULL;
//struct stat file_stat;
@@ -329,7 +329,7 @@ static esp_err_t logfileact_get_handler(httpd_req_t *req)
/* Handler to download a file kept on the server */
static esp_err_t download_get_handler(httpd_req_t *req)
{
LogFile.WriteToFile("download_get_handler");
LogFile.WriteToFile(ESP_LOG_DEBUG, "download_get_handler");
char filepath[FILE_PATH_MAX];
FILE *fd = NULL;
struct stat file_stat;
@@ -430,7 +430,7 @@ static esp_err_t download_get_handler(httpd_req_t *req)
/* Handler to upload a file onto the server */
static esp_err_t upload_post_handler(httpd_req_t *req)
{
LogFile.WriteToFile("upload_post_handler");
LogFile.WriteToFile(ESP_LOG_DEBUG, "upload_post_handler");
char filepath[FILE_PATH_MAX];
FILE *fd = NULL;
struct stat file_stat;
@@ -573,7 +573,7 @@ static esp_err_t upload_post_handler(httpd_req_t *req)
/* Handler to delete a file from the server */
static esp_err_t delete_post_handler(httpd_req_t *req)
{
LogFile.WriteToFile("delete_post_handler");
LogFile.WriteToFile(ESP_LOG_DEBUG, "delete_post_handler");
char filepath[FILE_PATH_MAX];
struct stat file_stat;

View File

@@ -296,7 +296,7 @@ esp_err_t handler_ota_update(httpd_req_t *req)
LogFile.WriteHeapInfo("handler_ota_update - Start");
#endif
LogFile.WriteToFile("handler_ota_update");
LogFile.WriteToFile(ESP_LOG_DEBUG, "handler_ota_update");
char _query[200];
char _filename[100];
char _valuechar[30];
@@ -493,8 +493,8 @@ void task_reboot(void *pvParameter)
void doReboot(){
LogFile.SwitchOnOff(true);
LogFile.WriteToFile("Reboot triggered by Software (5s).");
LogFile.WriteToFile("Reboot in 5sec");
LogFile.WriteToFile(ESP_LOG_INFO, "Reboot triggered by Software (5s).");
LogFile.WriteToFile(ESP_LOG_WARN, "Reboot in 5sec");
xTaskCreate(&task_reboot, "reboot", configMINIMAL_STACK_SIZE * 64, NULL, 10, NULL);
// KillTFliteTasks(); // kills itself
gpio_handler_destroy();
@@ -510,7 +510,7 @@ esp_err_t handler_reboot(httpd_req_t *req)
LogFile.WriteHeapInfo("handler_reboot - Start");
#endif
LogFile.WriteToFile("handler_reboot");
LogFile.WriteToFile(ESP_LOG_DEBUG, "handler_reboot");
ESP_LOGI(TAGPARTOTA, "!!! System will restart within 5 sec!!!");
const char* resp_str = "<body style='font-family: arial'> <h3 id=t></h3></body><script>var h='Rebooting!<br>The page will automatically reload in around 25..60s.<br>'; document.getElementById('t').innerHTML=h; setInterval(function (){h +='.'; document.getElementById('t').innerHTML=h; fetch(window.location.hostname,{mode: 'no-cors'}).then(r=>{parent.location.href=('/index.html');})}, 1000);</script>";
httpd_resp_send(req, resp_str, strlen(resp_str));