esp_log_level_set("*", ESP_LOG_ERROR); // set all components to ERROR level
esp_log_level_set("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack
esp_log_level_set("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client
开启Enable log set level后如下操作才起作用
esp_log_level_set("*", ESP_LOG_NONE);
esp_log_level_set("ESP_LOG_EXAMPLE", ESP_LOG_ERROR);
esp_log_level_set("ESP_LOG_EXAMPLE", ESP_LOG_WARN);
esp_log_level_set("ESP_LOG_EXAMPLE", ESP_LOG_INFO);
esp_log_level_set("ESP_LOG_EXAMPLE", ESP_LOG_DEBUG);
esp_log_level_set("ESP_LOG_EXAMPLE", ESP_LOG_VERBOSE);
#define LOG_LOCAL_LEVEL ESP_LOG_NONE
#include "esp_log.h"
ESP_LOGE(TAG, "[APP] Startup..");
ESP_LOGE(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGE(TAG, "[APP] IDF version: %s", esp_get_idf_version());
ESP_LOGW(TAG, "[APP] Startup..");
ESP_LOGW(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGW(TAG, "[APP] IDF version: %s", esp_get_idf_version());
ESP_LOGI(TAG, "[APP] Startup..");
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
ESP_LOGD(TAG, "[APP] Startup..");
ESP_LOGD(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGD(TAG, "[APP] IDF version: %s", esp_get_idf_version());
ESP_LOGV(TAG, "[APP] Startup..");
ESP_LOGV(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGV(TAG, "[APP] IDF version: %s", esp_get_idf_version());