EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1018 background imageLoading...
Page #1018 background image
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} PUBLIC "-DLOG_LOCAL_LEVEL=ESP_LOG_
,VERBOSE")
To configure logging output per module at runtime, add calls to the function esp_log_level_set() as follows:
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
Note: TheDRAMandEARLYlog macro variants documented above do not support per module setting of
log verbosity. These macros will always log at the defaultverbosity level, which can only be changed at runtime
by calling esp_log_level("*", level).
Logging to Host via JTAG By default, the logging library uses the vprintf-like function to write formatted output
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 Logging to Host.
Application Example
The logging library is commonly used by most esp-idf components and examples. For demonstration of log function-
ality, check ESP-IDFs examples directory. The most revelant examples that deal with logging are the following:
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, esp_log_level_t level)
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 1007
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish