Chapter 2. API Reference
Parameters
• tag: Tag of the log to query current level. Must be a non-NULL zero terminated string.
vprintf_like_t esp_log_set_vprintf(vprintf_like_t
Set function used to output log entries.
By default, log output goes to UART0. This function can be used to redirect log output to some other destina-
tion, such as file or network. Returns the original log handler, which may be necessary to return output to the
previous destination.
Note Please note that function callback here must be re-entrant as it can be invoked in parallel from multiple
thread context.
Return func old Function used for output.
Parameters
• func: new Function used for output. Must have same signature as vprintf.
uint32_t esp_log_timestamp(void)
Function which returns timestamp to be used in log output.
This function is used in expansion of ESP_LOGx macros. In the 2nd stage bootloader, and at early application
startup stage this function uses CPU cycle counter as time source. Later when FreeRTOS scheduler start
running, it switches to FreeRTOS tick count.
For now, we ignore millisecond counter overflow.
Return timestamp, in milliseconds
char *esp_log_system_timestamp(void)
Function which returns system timestamp to be used in log output.
This function is used in expansion of ESP_LOGx macros to print the system time as"HH:MM:SS.sss". The
system time is initialized to 0 on startup, this can be set to the correct time with an SNTP sync, or manually
with standard POSIX time functions.
Currently this will not get used in logging from binary blobs (i.e WiFi & Bluetooth libraries), these will still
print the RTOS tick time.
Return timestamp, in "HH:MM:SS.sss"
uint32_t esp_log_early_timestamp(void)
Function which returns timestamp to be used in log output.
This function uses HW cycle counter and does not depend on OS, so it can be safely used after application
crash.
Return timestamp, in milliseconds
void
esp_log_write(esp_log_level_t
Write message into the log.
This function is not intended to be used directly. Instead, use one of ESP_LOGE, ESP_LOGW, ESP_LOGI,
ESP_LOGD, ESP_LOGV macros.
This function or these macros should not be used from an interrupt.
void
esp_log_writev(esp_log_level_t
Write message into the log, va_list variant.
This function is provided to ease integration toward other logging framework, so that esp_log can be used as a
log sink.
See esp_log_write()
Macros
ESP_LOG_BUFFER_HEX_LEVEL(tag, buffer, buff_len, level)
Log a buffer of hex bytes at specified level, separated into 16 bytes each line.
Parameters
Espressif Systems
func)
level, const char *tag, const char *format, ...)
level, const char *tag, const char *format, va_list args)
1008
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?