Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Logger control API

Logger control API. More...

Macros

#define LOG_CORE_INIT()   do { } while (false)
 
#define LOG_INIT()   0
 
#define LOG_PANIC()   /* Empty */
 
#define LOG_PROCESS()   false
 

Typedefs

typedef log_timestamp_t(* log_timestamp_get_t) (void)
 

Functions

void log_core_init (void)
 Function system initialization of the logger. More...
 
void log_init (void)
 Function for user initialization of the logger. More...
 
void log_thread_set (k_tid_t process_tid)
 Function for providing thread which is processing logs. More...
 
int log_set_timestamp_func (log_timestamp_get_t timestamp_getter, uint32_t freq)
 Function for providing timestamp function. More...
 
void log_panic (void)
 Switch the logger subsystem to the panic mode. More...
 
bool log_process (bool bypass)
 Process one pending log message. More...
 
uint32_t log_buffered_cnt (void)
 Return number of buffered log messages. More...
 
uint32_t log_src_cnt_get (uint32_t domain_id)
 Get number of independent logger sources (modules and instances) More...
 
const char * log_source_name_get (uint32_t domain_id, uint32_t source_id)
 Get name of the source (module or instance). More...
 
const char * log_domain_name_get (uint32_t domain_id)
 Get name of the domain. More...
 
uint32_t log_filter_get (struct log_backend const *const backend, uint32_t domain_id, int16_t source_id, bool runtime)
 Get source filter for the provided backend. More...
 
uint32_t log_filter_set (struct log_backend const *const backend, uint32_t domain_id, int16_t source_id, uint32_t level)
 Set filter on given source for the provided backend. More...
 
void log_backend_enable (struct log_backend const *const backend, void *ctx, uint32_t level)
 Enable backend with initial maximum filtering level. More...
 
void log_backend_disable (struct log_backend const *const backend)
 Disable backend. More...
 

Detailed Description

Logger control API.

Macro Definition Documentation

◆ LOG_CORE_INIT

#define LOG_CORE_INIT ( )    do { } while (false)

◆ LOG_INIT

#define LOG_INIT ( )    0

◆ LOG_PANIC

#define LOG_PANIC ( )    /* Empty */

◆ LOG_PROCESS

#define LOG_PROCESS ( )    false

Typedef Documentation

◆ log_timestamp_get_t

typedef log_timestamp_t(* log_timestamp_get_t) (void)

Function Documentation

◆ log_backend_disable()

void log_backend_disable ( struct log_backend const *const  backend)

#include <include/logging/log_ctrl.h>

Disable backend.

Parameters
backendBackend instance.

◆ log_backend_enable()

void log_backend_enable ( struct log_backend const *const  backend,
void ctx,
uint32_t  level 
)

#include <include/logging/log_ctrl.h>

Enable backend with initial maximum filtering level.

Parameters
backendBackend instance.
ctxUser context.
levelSeverity level.

◆ log_buffered_cnt()

uint32_t log_buffered_cnt ( void  )

#include <include/logging/log_ctrl.h>

Return number of buffered log messages.

Returns
Number of currently buffered log messages.

◆ log_core_init()

void log_core_init ( void  )

#include <include/logging/log_ctrl.h>

Function system initialization of the logger.

Function is called during start up to allow logging before user can explicitly initialize the logger.

◆ log_domain_name_get()

const char * log_domain_name_get ( uint32_t  domain_id)

#include <include/logging/log_ctrl.h>

Get name of the domain.

Parameters
domain_idDomain ID.
Returns
Domain name.

◆ log_filter_get()

uint32_t log_filter_get ( struct log_backend const *const  backend,
uint32_t  domain_id,
int16_t  source_id,
bool  runtime 
)

#include <include/logging/log_ctrl.h>

Get source filter for the provided backend.

Parameters
backendBackend instance.
domain_idID of the domain.
source_idSource (module or instance) ID.
runtimeTrue for runtime filter or false for compiled in.
Returns
Severity level.

◆ log_filter_set()

uint32_t log_filter_set ( struct log_backend const *const  backend,
uint32_t  domain_id,
int16_t  source_id,
uint32_t  level 
)

#include <include/logging/log_ctrl.h>

Set filter on given source for the provided backend.

Parameters
backendBackend instance. NULL for all backends.
domain_idID of the domain.
source_idSource (module or instance) ID.
levelSeverity level.
Returns
Actual level set which may be limited by compiled level. If filter was set for all backends then maximal level that was set is returned.

◆ log_init()

void log_init ( void  )

#include <include/logging/log_ctrl.h>

Function for user initialization of the logger.

◆ log_panic()

void log_panic ( void  )

#include <include/logging/log_ctrl.h>

Switch the logger subsystem to the panic mode.

Returns immediately if the logger is already in the panic mode.

On panic the logger subsystem informs all backends about panic mode. Backends must switch to blocking mode or halt. All pending logs are flushed after switching to panic mode. In panic mode, all log messages must be processed in the context of the call.

◆ log_process()

bool log_process ( bool  bypass)

#include <include/logging/log_ctrl.h>

Process one pending log message.

Parameters
bypassIf true message is released without being processed.
Return values
trueThere is more messages pending to be processed.
falseNo messages pending.

◆ log_set_timestamp_func()

int log_set_timestamp_func ( log_timestamp_get_t  timestamp_getter,
uint32_t  freq 
)

#include <include/logging/log_ctrl.h>

Function for providing timestamp function.

Parameters
timestamp_getterTimestamp function.
freqTimestamping frequency.
Returns
0 on success or error.

◆ log_source_name_get()

const char * log_source_name_get ( uint32_t  domain_id,
uint32_t  source_id 
)

#include <include/logging/log_ctrl.h>

Get name of the source (module or instance).

Parameters
domain_idDomain ID.
source_idSource ID.
Returns
Source name or NULL if invalid arguments.

◆ log_src_cnt_get()

uint32_t log_src_cnt_get ( uint32_t  domain_id)

#include <include/logging/log_ctrl.h>

Get number of independent logger sources (modules and instances)

Parameters
domain_idDomain ID.
Returns
Number of sources.

◆ log_thread_set()

void log_thread_set ( k_tid_t  process_tid)

#include <include/logging/log_ctrl.h>

Function for providing thread which is processing logs.

See CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD.

Note
Function has asserts and has no effect when CONFIG_LOG_PROCESS_THREAD is set.
Parameters
process_tidProcess thread id. Used to wake up the thread.