debug messages optimized in http and cron

This commit is contained in:
Bogdan Pilyugin 2023-10-24 11:16:37 +02:00
parent e6b67333df
commit 490bf91161
2 changed files with 10 additions and 10 deletions

View File

@ -69,9 +69,6 @@ static void ExecuteLastAction(obj_struct_t *objarr)
char *obj = objarr[obj_idx].object_name;
if (*obj == '\0')
break;
//ESP_LOGI(TAG, "Check object %s", obj);
for (shdl = 0; shdl < CRON_TIMERS_NUMBER; shdl++)
{
memcpy(objname, GetSysConf()->Timers[shdl].exec, CONFIG_WEBGUIAPP_MAX_COMMAND_STRING_LENGTH / 4);
@ -98,7 +95,7 @@ static void ExecuteLastAction(obj_struct_t *objarr)
if (minimal != -1)
{
ESP_LOGW(TAG, "Run previous CRON \"%s\" with delta %d", GetSysConf()->Timers[minimal].exec, (int )delta);
ESP_LOGI(TAG, "Run previous CRON \"%s\" with delta %d", GetSysConf()->Timers[minimal].exec, (int )delta);
ExecCommand(GetSysConf()->Timers[minimal].exec);
}
@ -107,7 +104,7 @@ static void ExecuteLastAction(obj_struct_t *objarr)
void TimeObtainHandler(struct timeval *tm)
{
ESP_LOGW(TAG, "Current time received with value %d", (unsigned int )tm->tv_sec);
ESP_LOGI(TAG, "Current time updated with value %d", (unsigned int )tm->tv_sec);
ReloadCronSheduler();
ExecuteLastAction(GetSystemObjects());
ExecuteLastAction(GetCustomObjects());

View File

@ -176,12 +176,11 @@ static const char* get_path_from_uri(char *dest, const char *base_path,
static esp_err_t POSTHandler(httpd_req_t *req)
{
#if HTTP_SERVER_DEBUG_LEVEL > 0
ESP_LOGI(TAG, "POST request handle");
ESP_LOGI(TAG, "POST request handle URL: %s", req->uri);
#endif
if (memmem(req->uri, strlen(req->uri), "/storage/upload/", sizeof("/storage/upload/") - 1))
return upload_post_handler(req);
if (memmem(req->uri, strlen(req->uri), "/storage/delete/", sizeof("/storage/delete/") - 1))
return delete_post_handler(req);
@ -240,7 +239,7 @@ static esp_err_t POSTHandler(httpd_req_t *req)
static esp_err_t GETHandler2(httpd_req_t *req)
{
#if HTTP_SERVER_DEBUG_LEVEL > 0
ESP_LOGI(TAG, "GET request handle");
ESP_LOGI(TAG, "GET request handle URL: %s",req->uri);
#endif
//Route to file server GET handler
@ -291,7 +290,7 @@ static esp_err_t GETHandler2(httpd_req_t *req)
espfs_stat(fs, filepath, &stat);
#if HTTP_SERVER_DEBUG_LEVEL > 0
ESP_LOGI(TAG, "Sending file : %s (%d bytes)...", filename,
ESP_LOGI(TAG, "BEGIN send file : %s (%d bytes)...", filename,
stat.size);
#endif
@ -334,6 +333,10 @@ static esp_err_t GETHandler2(httpd_req_t *req)
while (chunksize != 0);
/* Close file after sending complete */
espfs_fclose(file);
#if HTTP_SERVER_DEBUG_LEVEL > 0
ESP_LOGI(TAG, "END send file : %s (%d bytes)...", filename,
stat.size);
#endif
/* Respond with an empty chunk to signal HTTP response completion */
#ifdef CONFIG_EXAMPLE_HTTPD_CONN_CLOSE_HEADER
httpd_resp_set_hdr(req, "Connection", "close");
@ -346,7 +349,7 @@ static httpd_handle_t start_webserver(void)
{
httpd_handle_t server = NULL;
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.lru_purge_enable = true;
config.lru_purge_enable = false;
config.uri_match_fn = httpd_uri_match_wildcard;
config.stack_size = (4096 + 2048);