Firmware SDK
twr_log

Logging facility (output on TXD2, format 115200 / 8N1) More...

Macros

#define TWR_LOG_UART   TWR_UART_UART2
 
#define TWR_LOG_BUFFER_SIZE   256
 
#define TWR_LOG_DUMP_WIDTH   8
 

Enumerations

enum  twr_log_level_t {
  TWR_LOG_LEVEL_DUMP = 0 ,
  TWR_LOG_LEVEL_DEBUG = 1 ,
  TWR_LOG_LEVEL_INFO = 2 ,
  TWR_LOG_LEVEL_WARNING = 3 ,
  TWR_LOG_LEVEL_ERROR = 4 ,
  TWR_LOG_LEVEL_OFF = 5
}
 Log level. More...
 
enum  twr_log_timestamp_t {
  TWR_LOG_TIMESTAMP_OFF = -1 ,
  TWR_LOG_TIMESTAMP_ABS = 0 ,
  TWR_LOG_TIMESTAMP_REL = 1
}
 Log timestamp. More...
 

Functions

void twr_log_init (twr_log_level_t level, twr_log_timestamp_t timestamp)
 Initialize logging facility. More...
 
void twr_log_dump (const void *buffer, size_t length, const char *format,...) __attribute__((format(printf
 Log DUMP message (annotated in log as <X>) More...
 
void void twr_log_debug (const char *format,...) __attribute__((format(printf
 Log DEBUG message (annotated in log as <D>) More...
 
void void void twr_log_info (const char *format,...) __attribute__((format(printf
 Log INFO message (annotated in log as ) More...
 
void void void void twr_log_warning (const char *format,...) __attribute__((format(printf
 Log WARNING message (annotated in log as <W>) More...
 
void void void void void twr_log_error (const char *format,...) __attribute__((format(printf
 Log ERROR message (annotated in log as <E>) More...
 

Detailed Description

Logging facility (output on TXD2, format 115200 / 8N1)

Enumeration Type Documentation

◆ twr_log_level_t

Log level.

Enumerator
TWR_LOG_LEVEL_DUMP 

Logging DUMP.

TWR_LOG_LEVEL_DEBUG 

Log level DEBUG.

TWR_LOG_LEVEL_INFO 

Log level INFO.

TWR_LOG_LEVEL_WARNING 

Log level WARNING.

TWR_LOG_LEVEL_ERROR 

Log level ERROR.

TWR_LOG_LEVEL_OFF 

Logging disabled.

Definition at line 23 of file twr_log.h.

◆ twr_log_timestamp_t

Log timestamp.

Enumerator
TWR_LOG_TIMESTAMP_OFF 

Timestamp logging disabled.

TWR_LOG_TIMESTAMP_ABS 

Timestamp logging enabled (absolute time format)

TWR_LOG_TIMESTAMP_REL 

Timestamp logging enabled (relative time format)

Definition at line 47 of file twr_log.h.

Function Documentation

◆ twr_log_debug()

void void twr_log_debug ( const char *  format,
  ... 
)

Log DEBUG message (annotated in log as <D>)

Parameters
[in]formatFormat string (printf style)
[in]...Optional format arguments

◆ twr_log_dump()

void twr_log_dump ( const void *  buffer,
size_t  length,
const char *  format,
  ... 
)

Log DUMP message (annotated in log as <X>)

Parameters
[in]bufferPointer to source buffer
[in]lengthNumber of bytes to be printed
[in]formatFormat string (printf style)
[in]...Optional format arguments

◆ twr_log_error()

void void void void void twr_log_error ( const char *  format,
  ... 
)

Log ERROR message (annotated in log as <E>)

Parameters
[in]formatFormat string (printf style)
[in]...Optional format arguments

Referenced by twr_ds2484_enable(), and twr_module_x1_init().

Here is the caller graph for this function:

◆ twr_log_info()

void void void twr_log_info ( const char *  format,
  ... 
)

Log INFO message (annotated in log as )

Parameters
[in]formatFormat string (printf style)
[in]...Optional format arguments

◆ twr_log_init()

void twr_log_init ( twr_log_level_t  level,
twr_log_timestamp_t  timestamp 
)

Initialize logging facility.

Parameters
[in]levelMinimum required message level for propagation
[in]timestampTimestamp logging setting

Definition at line 22 of file twr_log.c.

Here is the call graph for this function:

◆ twr_log_warning()

void void void void twr_log_warning ( const char *  format,
  ... 
)

Log WARNING message (annotated in log as <W>)

Parameters
[in]formatFormat string (printf style)
[in]...Optional format arguments