Debug LOG API

Debug log related APIs for ESP-NOW.

API Reference

Header File

Functions

esp_err_t espnow_log_get_config(espnow_log_config_t *config)

Get the configuration of the log during wireless debugging.

Parameters:

config[out] the configuration of the log

Returns:

  • ESP_OK

  • ESP_FAIL

esp_err_t espnow_log_set_config(const espnow_log_config_t *config)

Set the configuration of the log during wireless debugging.

Parameters:

config[in] the configuration of the log

Returns:

  • ESP_OK

  • ESP_FAIL

esp_err_t espnow_log_init(const espnow_log_config_t *config)

Initialize log debug.

  • Set log debug configuration

  • Create the log sendinng task

Parameters:

config[in] the configuration of the log

Returns:

  • ESP_OK

esp_err_t espnow_log_deinit(void)

De-initialize log debug Call this once when done using log debug functions.

Returns:

  • ESP_OK

esp_err_t espnow_log_flash_read(char *data, size_t *size)

Read memory log data in flash.

Parameters:
  • data[out] log data read from the flash’s spiffs files

  • size[inout] size of the read data in bytes

Returns:

  • ESP_OK

  • ESP_FAIL

size_t espnow_log_flash_size(void)

Get the size of log stored in flash.

Returns:

  • size _cplusplus

Structures

struct espnow_log_config_s

Log sending configuration.

Public Members

esp_log_level_t log_level_uart

Level of log printed from uart

esp_log_level_t log_level_flash

Level of log stored in flash

esp_log_level_t log_level_espnow

Level of log sent from espnow

esp_log_level_t log_level_custom

Level of log defined by customer

espnow_log_custom_write_cb log_custom_write

Customer defined log callback function

Macros

DEBUG_LOG_PRINTF(fmt, ...)

Configuration of debug log stored in flash. Whether to output information according to the client needs. Please assign CONFIG_ESPNOW_DEBUG_LOG_PRINTF_ENABLE a value.

< _cplusplus

Note

CONFIG_ESPNOW_DEBUG_LOG_PRINTF_ENABLE = 1 enable CONFIG_ESPNOW_DEBUG_LOG_PRINTF_ENABLE = 0 disable

DEBUG_LOG_MALLOC
DEBUG_LOG_FREE
CONFIG_ESPNOW_DEBUG_SECURITY
ESP_EVENT_ESPNOW_LOG_FLASH_FULL

Enumerated list of debug event id.

Type Definitions

typedef esp_err_t (*espnow_log_custom_write_cb)(const char *data, size_t size, const char *tag, esp_log_level_t level)

The log callback function.

Attention

Each time a log is sent, the callback function will be called if defined.

Param data:

[in] the log data

Param size:

[in] the log data size in bytes

Param tag:

[in] the log tag

Param level:

[in] the log level

Return:

  • ESP_OK

  • ESP_FAIL

typedef struct espnow_log_config_s espnow_log_config_t

Log sending configuration.