Solaris Software
Loading...
Searching...
No Matches
log.h File Reference

SPP logging service. More...

Include dependency graph for log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SPP_LOGE(tag, fmt, ...)
#define SPP_LOGW(tag, fmt, ...)
#define SPP_LOGI(tag, fmt, ...)
#define SPP_LOGD(tag, fmt, ...)
#define SPP_LOGV(tag, fmt, ...)

Typedefs

typedef void(*) SPP_LogOutputFn_t(const char *p_tag, SPP_LogLevel_t level, const char *p_message)

Enumerations

enum  SPP_LogLevel_t {
  K_SPP_LOG_NONE = 0 , K_SPP_LOG_ERROR = 1 , K_SPP_LOG_WARN = 2 , K_SPP_LOG_INFO = 3 ,
  K_SPP_LOG_DEBUG = 4 , K_SPP_LOG_VERBOSE = 5
}

Functions

SPP_RetVal_t SPP_SERVICES_LOG_init (void)
void SPP_SERVICES_LOG_setLevel (SPP_LogLevel_t level)
SPP_LogLevel_t SPP_SERVICES_LOG_getLevel (void)
void SPP_SERVICES_LOG_setOutput (SPP_LogOutputFn_t p_fn)
void SPP_SERVICES_LOG_emit (const char *p_tag, SPP_LogLevel_t level, const char *p_fmt,...)

Detailed Description

SPP logging service.

Usage: SPP_LOGI("MY_MODULE", "sensor value = %.2f", value);

Each macro formats the message and calls the active output function. By default that function prints to stdout. SPP_CORE_boot() replaces it with one that also publishes each message as a pub/sub packet so subscribers (e.g. the SD card logger) receive log lines automatically.

To silence everything: SPP_SERVICES_LOG_setLevel(K_SPP_LOG_NONE) To change destination: SPP_SERVICES_LOG_setOutput(myFn)

Definition in file log.h.

Macro Definition Documentation

◆ SPP_LOGE

#define SPP_LOGE ( tag,
fmt,
... )
Value:
SPP_SERVICES_LOG_emit((tag), K_SPP_LOG_ERROR, (fmt), ##__VA_ARGS__)
void SPP_SERVICES_LOG_emit(const char *p_tag, SPP_LogLevel_t level, const char *p_fmt,...)
Definition log.c:42
@ K_SPP_LOG_ERROR
Definition log.h:30

Definition at line 67 of file log.h.

Referenced by SPP_SERVICES_BMP390_acquireData(), SPP_SERVICES_BMP390_configCheck(), SPP_SERVICES_ICM20948_acquireData(), SPP_SERVICES_ICM20948_configDmpInit(), and SPP_SERVICES_ICM20948_init().

◆ SPP_LOGW

#define SPP_LOGW ( tag,
fmt,
... )
Value:
SPP_SERVICES_LOG_emit((tag), K_SPP_LOG_WARN, (fmt), ##__VA_ARGS__)
@ K_SPP_LOG_WARN
Definition log.h:31

Definition at line 68 of file log.h.

Referenced by SPP_SERVICES_BMP390_acquireData().

◆ SPP_LOGI

◆ SPP_LOGD

#define SPP_LOGD ( tag,
fmt,
... )
Value:
SPP_SERVICES_LOG_emit((tag), K_SPP_LOG_DEBUG, (fmt), ##__VA_ARGS__)
@ K_SPP_LOG_DEBUG
Definition log.h:33

Definition at line 70 of file log.h.

◆ SPP_LOGV

#define SPP_LOGV ( tag,
fmt,
... )
Value:
SPP_SERVICES_LOG_emit((tag), K_SPP_LOG_VERBOSE, (fmt), ##__VA_ARGS__)
@ K_SPP_LOG_VERBOSE
Definition log.h:34

Definition at line 71 of file log.h.

Typedef Documentation

◆ SPP_LogOutputFn_t

typedef void(*) SPP_LogOutputFn_t(const char *p_tag, SPP_LogLevel_t level, const char *p_message)

Definition at line 44 of file log.h.

Enumeration Type Documentation

◆ SPP_LogLevel_t

Enumerator
K_SPP_LOG_NONE 
K_SPP_LOG_ERROR 
K_SPP_LOG_WARN 
K_SPP_LOG_INFO 
K_SPP_LOG_DEBUG 
K_SPP_LOG_VERBOSE 

Definition at line 27 of file log.h.

Function Documentation

◆ SPP_SERVICES_LOG_init()

SPP_RetVal_t SPP_SERVICES_LOG_init ( void )

Definition at line 20 of file log.c.

References K_SPP_LOG_VERBOSE, K_SPP_OK, s_level, s_outFn, and SPP_SERVICES_LOG_init().

Referenced by SPP_CORE_init(), and SPP_SERVICES_LOG_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_LOG_setLevel()

void SPP_SERVICES_LOG_setLevel ( SPP_LogLevel_t level)

Definition at line 27 of file log.c.

References s_level, and SPP_SERVICES_LOG_setLevel().

Referenced by SPP_SERVICES_LOG_setLevel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_LOG_getLevel()

SPP_LogLevel_t SPP_SERVICES_LOG_getLevel ( void )

Definition at line 32 of file log.c.

References s_level, and SPP_SERVICES_LOG_getLevel().

Referenced by SPP_SERVICES_LOG_getLevel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_LOG_setOutput()

void SPP_SERVICES_LOG_setOutput ( SPP_LogOutputFn_t p_fn)

Definition at line 37 of file log.c.

References s_outFn, and SPP_SERVICES_LOG_setOutput().

Referenced by SPP_SERVICES_LOG_setOutput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_LOG_emit()

void SPP_SERVICES_LOG_emit ( const char * p_tag,
SPP_LogLevel_t level,
const char * p_fmt,
... )

Definition at line 42 of file log.c.

References K_LOG_BUF_SIZE, s_level, s_outFn, and SPP_SERVICES_LOG_emit().

Referenced by SPP_SERVICES_LOG_emit().

Here is the call graph for this function:
Here is the caller graph for this function: