Logging

File: es_log.h

Description: ES Client lib logging utility. To use this module it is required to ‘attach’ it to a configured UART interface. The tx handler of the log_iface should be assigned to a functional UART transmit handler.

Example Usage

Initialize the ES Client log module
1uint32_t baudrate = 115200;
2
3es_log_iface_t log_iface = es_log_iface_init_default;
4es_uart_dbg_drv_init(baudrate); // Target specific UART init function
5log_iface.timestamp = es_system_get_tick;  // Target specific get tick handler
6log_iface.drv_iface.tx = es_uart_dbg_drv_tx; // Target specific UART transmit handler
7es_log_init(&log_iface);
8es_log_set_lvl(ES_INFO);
9ES_LOG_MSG(ES_INFO, "Logging Initialized");

Log Levels

enumerator es_log_lvl_t
[source]

ES log levels

enumerator ES_CRITICAL
[source]

One or more key business functionalities are not working and the whole system doesn’t fulfill the business functionalities.

enumerator ES_DEBUG
[source]

A log level used for events considered to be useful during software debugging when more granular information is needed.

enumerator ES_ERROR
[source]

One or more functionalities are not working, preventing some functionalities from working correctly.

enumerator ES_INFO
[source]

An event happened, the event is purely informative and can be ignored during normal operations.

enumerator ES_TRACE
[source]

A log level describing events showing step by step execution of your code that can be ignored during the standard operation, but may be useful during extended debugging sessions.

enumerator ES_WARNING
[source]

Unexpected behavior happened inside the application, but it is continuing its work and the key business features are operating as expected.

MACROS

ES_LOG_MSG(level, msg)
[source]

Log a message

Parameters:
  • level – Log level of the message

  • msg – VA_ARGS formated message

ES_LOG_HEXDUMP(desc, mem_ptr, len)
[source]

Hexdump a memory region

Parameters:
  • desc – Description of the memory in free form text

  • mem_ptr – Memory to dump

  • len – Size of the memory to dump starting from address mem_ptr

Interface

type es_log_iface_t
[source]

Es log interface

Note

In order to use the logging utility it is necessary to initialize the tx handler.

es_log_timestamp_hndlr_t timestamp
[source]

timestamp handler

es_log_tx_hndlr_t tx
[source]

TX handler

Interface Functions

void es_log_init(es_log_iface_t *log_iface)
[source]

Initialize es log interface.

Parameters:
  • log_iface: – Reference to intialized es_log_iface_t structure

void es_log_set_lvl(es_log_lvl_t level)
[source]

Set log level

Parameters:
  • level: – Log level

es_log_lvl_t es_log_get_lvl(void)
[source]

Get the current log level

Will be deprecated

Returns:

Returns the current log level