Chapter 2. API Reference
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
#include
"esp_log.h"
At component scope, define it in the component makefile:
target_compile_definitions(${COMPONENT_LIB}
VERBOSE")
→
To configure logging output per module at runtime, add calls to the function
esp_log_level_set("*", ESP_LOG_ERROR);
esp_log_level_set("wifi", ESP_LOG_WARN);
esp_log_level_set("dhcpc", ESP_LOG_INFO);
Note: The "DRAM"and "EARLY"log macro variants documented above do not support per module setting of
log verbosity. These macros will always log at the "default"verbosity level, which can only be changed at runtime
by calling esp_log_level("*", level).
Logging to Host via JTAG
to the dedicated UART. By calling a simple API, all log output may be routed to JTAG instead, making logging
several times faster. For details, please refer to Section
Application Example
The logging library is commonly used by most esp-idf components and examples. For demonstration of log function-
ality, check ESP-IDF's
examples
•
system/ota
•
storage/sd_card
•
protocols/https_request
API Reference
Header File
•
components/log/include/esp_log.h
Functions
void esp_log_level_set(const char *tag,
Set log level for given tag.
If logging for given component has already been enabled, changes previous setting.
Note that this function can not raise log level above the level set using CONFIG_LOG_MAXIMUM_LEVEL
setting in menuconfig.
To raise log level above the default one for a given file, define LOG_LOCAL_LEVEL to one of the
ESP_LOG_* values, before including esp_log.h in this file.
Parameters
• tag: Tag of the log entries to enable. Must be a non-NULL zero terminated string. Value "*"
resets log level for all tags to the given value.
• level: Selects log level to enable. Only logs at this and lower verbosity levels will be shown.
esp_log_level_t
esp_log_level_get(const char *tag)
Get log level for given tag, can be used to avoid expensive log statements.
Return The current log level for the given tag
Espressif Systems
By default, the logging library uses the vprintf-like function to write formatted output
Logging to
directory. The most revelant examples that deal with logging are the following:
esp_log_level_t
1007
Submit Document Feedback
PUBLIC "-DLOG_LOCAL_LEVEL=ESP_LOG_
esp_log_level_set()
// set all components to ERROR level
// enable WARN logs from WiFi stack
// enable INFO logs from DHCP client
Host.
level)
as follows:
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?