Contiki-NG
Functions
Per-module, per-level logging

The log module performs per-module, per-level logging. More...

Functions

void log_6addr (const uip_ipaddr_t *ipaddr)
 Logs an IPv6 address. More...
 
int log_6addr_compact_snprint (char *buf, size_t size, const uip_ipaddr_t *ipaddr)
 Write at most size - 1 characters of the IP address to the output string, in a compact representation. More...
 
void log_6addr_compact (const uip_ipaddr_t *ipaddr)
 Logs an IPv6 address with a compact format. More...
 
void log_lladdr (const linkaddr_t *lladdr)
 Logs a link-layer address. More...
 
void log_lladdr_compact (const linkaddr_t *lladdr)
 Logs a link-layer address with a compact format. More...
 
void log_set_level (const char *module, int level)
 Sets a log level at run-time. More...
 
int log_get_level (const char *module)
 Returns the current log level. More...
 
const char * log_level_to_str (int level)
 Returns a textual description of a log level. More...
 

Detailed Description

The log module performs per-module, per-level logging.

Function Documentation

◆ log_6addr()

void log_6addr ( const uip_ipaddr_t *  ipaddr)

Logs an IPv6 address.

Parameters
ipaddrThe IPv6 address

Definition at line 87 of file log.c.

◆ log_6addr_compact()

void log_6addr_compact ( const uip_ipaddr_t *  ipaddr)

Logs an IPv6 address with a compact format.

Parameters
ipaddrThe IPv6 address

Definition at line 117 of file log.c.

◆ log_6addr_compact_snprint()

int log_6addr_compact_snprint ( char *  buf,
size_t  size,
const uip_ipaddr_t *  ipaddr 
)

Write at most size - 1 characters of the IP address to the output string, in a compact representation.

The output is always null-terminated, unless size is 0.

Parameters
bufA pointer to an output string with at least size bytes.
sizeThe max number of characters to write to the output string.
ipaddrA pointer to a uip_ipaddr_t that will be printed with printf().

Definition at line 95 of file log.c.

◆ log_get_level()

int log_get_level ( const char *  module)

Returns the current log level.

Parameters
moduleThe target module string descriptor
Returns
The current log level

Definition at line 176 of file log.c.

◆ log_level_to_str()

const char * log_level_to_str ( int  level)

Returns a textual description of a log level.

Parameters
levellog level
Returns
The textual description

Definition at line 192 of file log.c.

◆ log_lladdr()

void log_lladdr ( const linkaddr_t *  lladdr)

Logs a link-layer address.

Parameters
lladdrThe link-layer address

Definition at line 126 of file log.c.

◆ log_lladdr_compact()

void log_lladdr_compact ( const linkaddr_t *  lladdr)

Logs a link-layer address with a compact format.

Parameters
lladdrThe link-layer address

Definition at line 143 of file log.c.

◆ log_set_level()

void log_set_level ( const char *  module,
int  level 
)

Sets a log level at run-time.

Logs are included in the firmware via the compile-time flags in log-conf.h, but this allows to force lower log levels, system-wide.

Parameters
moduleThe target module string descriptor
levelThe log level

Definition at line 161 of file log.c.