Contiki-NG
Loading...
Searching...
No Matches
Per-module, per-level logging

Functions

void log_6addr (const uip_ipaddr_t *ipaddr)
 Logs an IPv6 address.
 
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.
 
void log_6addr_compact (const uip_ipaddr_t *ipaddr)
 Logs an IPv6 address with a compact format.
 
void log_lladdr (const linkaddr_t *lladdr)
 Logs a link-layer address.
 
void log_lladdr_compact (const linkaddr_t *lladdr)
 Logs a link-layer address with a compact format.
 
void log_bytes (const void *data, size_t length)
 Logs a byte array as hex characters.
 
void log_set_level (const char *module, int level)
 Sets a log level at run-time.
 
int log_get_level (const char *module)
 Returns the current log level.
 
const char * log_level_to_str (int level)
 Returns a textual description of a log level.
 

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 91 of file log.c.

References ipaddr, and uiplib_ipaddr_snprint().

Referenced by coap_endpoint_log().

◆ 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 121 of file log.c.

References ipaddr, and log_6addr_compact_snprint().

◆ 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 99 of file log.c.

References deployment_id_from_iid(), ipaddr, UIP_HTONS, uip_is_addr_linklocal, and uip_is_addr_mcast.

Referenced by log_6addr_compact(), rpl_neighbor_snprint(), and uip_sr_link_snprint().

◆ log_bytes()

void log_bytes ( const void * data,
size_t length )

Logs a byte array as hex characters.

Parameters
dataThe byte array
lengthThe length of the byte array

Definition at line 165 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 190 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 206 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 130 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 147 of file log.c.

References deployment_id_from_lladdr(), linkaddr_cmp(), linkaddr_null, and UIP_HTONS.

◆ 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 175 of file log.c.