c3dhall3  2.0.0.0
Data Structures | Macros | Enumerations | Functions
Logger Library

Data Structures

struct  log_t
 LOG context structure. More...
 
struct  log_cfg_t
 LOG init configuration structure. More...
 

Macros

#define LOG_MAP_USB_UART(cfg)
 LOG MAP to the USB UART configuration. More...
 
#define LOG_MAP_MIKROBUS(cfg, mikrobus)
 LOG MAP to the MikroBUS configuration. More...
 

Enumerations

enum  log_level_t {
  LOG_LEVEL_DEBUG = 0x00, LOG_LEVEL_INFO = 0x01, LOG_LEVEL_WARNING = 0x02, LOG_LEVEL_ERROR = 0x03,
  LOG_LEVEL_FATAL = 0x04
}
 Log level values. More...
 

Functions

void log_init (log_t *log, log_cfg_t *cfg)
 Initializes LOG module. More...
 
void log_printf (log_t *log, const code char *f,...)
 Printf function. More...
 
void log_clear (log_t *log)
 Discards all characters from the output and input buffer. More...
 
int8_t log_read (log_t *log, uint8_t *rx_data_buf, uint8_t max_len)
 Reads at most size bytes of data from the device into buffer. More...
 
void log_info (log_t *log, const code char *f,...)
 INFO printf function. More...
 
void log_error (log_t *log, const code char *f,...)
 ERROR printf function. More...
 
void log_fatal (log_t *log, const code char *f,...)
 FATAL printf function. More...
 
void log_debug (log_t *log, const code char *f,...)
 DEBUG printf function. More...
 
void log_warning (log_t *log, const code char *f,...)
 WARNING printf function. More...
 
void log_log (log_t *log, char *prefix, const code char *f,...)
 Printf function with a variable prefix. More...
 

Detailed Description

Macro Definition Documentation

◆ LOG_MAP_MIKROBUS

#define LOG_MAP_MIKROBUS (   cfg,
  mikrobus 
)
Value:
cfg.rx_pin = MIKROBUS(mikrobus, MIKROBUS_RX); \
cfg.tx_pin = MIKROBUS(mikrobus, MIKROBUS_TX); \
cfg.baud = 9600; \
cfg.level = LOG_LEVEL_DEBUG;
Definition: log.h:46

LOG MAP to the MikroBUS configuration.

◆ LOG_MAP_USB_UART

#define LOG_MAP_USB_UART (   cfg)
Value:
cfg.rx_pin = USB_UART_RX; \
cfg.tx_pin = USB_UART_TX; \
cfg.baud = 9600; \
cfg.level = LOG_LEVEL_DEBUG;
Definition: log.h:46

LOG MAP to the USB UART configuration.

Enumeration Type Documentation

◆ log_level_t

Log level values.

Enumerator
LOG_LEVEL_DEBUG 
LOG_LEVEL_INFO 
LOG_LEVEL_WARNING 
LOG_LEVEL_ERROR 
LOG_LEVEL_FATAL 

Function Documentation

◆ log_clear()

void log_clear ( log_t log)

Discards all characters from the output and input buffer.

Parameters
[in]logLOG context object.

◆ log_debug()

void log_debug ( log_t log,
const code char *  f,
  ... 
)

DEBUG printf function.

This function uses to be a print message on the UART. This function uses the prefix [DEBUG] and check for log level

Parameters
[in]logLOG context object.
[in]*fpointer to the string
[in]...Other parameters

◆ log_error()

void log_error ( log_t log,
const code char *  f,
  ... 
)

ERROR printf function.

This function uses to be a print message on the UART. This function uses the prefix [ERROR] and check for log level

Parameters
[in]logLOG context object.
[in]*fpointer to the string
[in]...Other parameters

◆ log_fatal()

void log_fatal ( log_t log,
const code char *  f,
  ... 
)

FATAL printf function.

This function uses to be a print message on the UART. This function uses the prefix [FATAL] and check for log level

Parameters
[in]logLOG context object.
[in]*fpointer to the string
[in]...Other parameters

◆ log_info()

void log_info ( log_t log,
const code char *  f,
  ... 
)

INFO printf function.

This function uses to be a print message on the UART. This function uses the prefix [INFO] and check for log level

Parameters
[in]logLOG context object.
[in]*fpointer to the string
[in]...Other parameters

◆ log_init()

void log_init ( log_t log,
log_cfg_t cfg 
)

Initializes LOG module.

Initializes LOG driver. This function needs to be called before other driver functions.

Parameters
[in]logLOG context object.
[in]cfgLOG configuration structure.

◆ log_log()

void log_log ( log_t log,
char *  prefix,
const code char *  f,
  ... 
)

Printf function with a variable prefix.

This function uses to be a print message on the UART. This function uses a variable prefix.

Parameters
[in]logLOG context object.
[in]prefixPrefix.
[in]*fpointer to the string
[in]...Other parameters

◆ log_printf()

void log_printf ( log_t log,
const code char *  f,
  ... 
)

Printf function.

This function uses to be a print message on the UART.

Parameters
[in]logLOG context object.
[in]*fpointer to the string
[in]...Other parameters

◆ log_read()

int8_t log_read ( log_t log,
uint8_t *  rx_data_buf,
uint8_t  max_len 
)

Reads at most size bytes of data from the device into buffer.

Parameters
[in]logLOG context object.
[out]rx_data_bufArray to place read data in.
[in]max_lenMaximal length
Returns
err_t Returns the number of bytes that were actually read, or -1 if an error occurred or no data read.

◆ log_warning()

void log_warning ( log_t log,
const code char *  f,
  ... 
)

WARNING printf function.

This function uses to be a print message on the UART. This function uses the prefix [WARNING] and check for log level

Parameters
[in]logLOG context object.
[in]*fpointer to the string
[in]...Other parameters