ESP-IDF Logging

Logging library
Logging to Host (via JTAG)

I (352) boot: Loaded app from partition at offset 0x10000
I (352) boot: Disabling RNG early entropy source...
W (101187) BT_RFCOMM: port_rfc_closed RFCOMM connection in state 2 closed: Closed (res: 19)
W (101227) BT_RFCOMM: rfc_find_lcid_mcb LCID reused LCID:0x42 current:0x0
W (101227) BT_RFCOMM: RFCOMM_DisconnectInd LCID:0x42
^     ^      ^
|     |      |
|     |     Tag
| Timestamp
Letter (E = Error, W = Warning, D = Debug, V = Verbose, I = Information)

#define LOG_FORMAT(letter, format)  LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n"

esp_log_write(ESP_LOG_ERROR,      tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__);

/**
 * @brief 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
 */
uint32_t esp_log_timestamp(void);

Leave a Reply

Your email address will not be published. Required fields are marked *