Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Log message API . More...

Data Structures

struct  log_msg_desc
 
union  log_msg_source
 
struct  log_msg_hdr
 
struct  log_msg
 
struct  log_msg_generic_hdr
 
union  log_msg_generic
 

Macros

#define LOG_MSG_GENERIC_HDR
 
#define LOG_MSG_SIMPLE_ARG_CNT_CHECK(...)
 
#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_0(fmt)
 
#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_1(fmt, arg)
 
#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_2(fmt, arg0, arg1)
 
#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK(...)
 brief Determine if string arguments types allow to use simplified message creation mode.
 
#define LOG_MSG_SIMPLE_CHECK(...)
 Check if message can be handled using simplified method.
 
#define LOG_MSG_SIMPLE_FUNC(_source, _level, ...)
 Call specific function to create a log message.
 

Functions

static uint32_t log_msg_get_total_wlen (const struct log_msg_desc desc)
 Get total length (in 32 bit words) of a log message.
 
static uint32_t log_msg_generic_get_wlen (const union mpsc_pbuf_generic *item)
 Get length of the log item.
 
static uint8_t log_msg_get_domain (struct log_msg *msg)
 Get log message domain ID.
 
static uint8_t log_msg_get_level (struct log_msg *msg)
 Get log message level.
 
static const void * log_msg_get_source (struct log_msg *msg)
 Get message source data.
 
int16_t log_msg_get_source_id (struct log_msg *msg)
 Get log message source ID.
 
static log_timestamp_t log_msg_get_timestamp (struct log_msg *msg)
 Get timestamp.
 
static void * log_msg_get_tid (struct log_msg *msg)
 Get Thread ID.
 
static uint8_tlog_msg_get_data (struct log_msg *msg, size_t *len)
 Get data buffer.
 
static uint8_tlog_msg_get_package (struct log_msg *msg, size_t *len)
 Get string package.
 

Detailed Description

Log message API .

Macro Definition Documentation

◆ LOG_MSG_GENERIC_HDR

#define LOG_MSG_GENERIC_HDR

#include <zephyr/logging/log_msg.h>

Value:
uint32_t type:1
#define MPSC_PBUF_HDR
Header that must be added to the first word in each packet.
Definition mpsc_packet.h:32
__UINT32_TYPE__ uint32_t
Definition stdint.h:90

◆ LOG_MSG_SIMPLE_ARG_CNT_CHECK

#define LOG_MSG_SIMPLE_ARG_CNT_CHECK ( ...)

#include <zephyr/logging/log_msg.h>

Value:
COND_CODE_1(UTIL_CAT(_LOG_MSG_SIMPLE_XXXX, NUM_VA_ARGS_LESS_1(__VA_ARGS__)), (1), (0))
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:195
#define NUM_VA_ARGS_LESS_1(...)
Number of arguments in the variable arguments list minus one.
Definition util_macro.h:647
#define UTIL_CAT(a,...)
Definition util_internal.h:104

◆ LOG_MSG_SIMPLE_ARG_TYPE_CHECK

#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK ( ...)

#include <zephyr/logging/log_msg.h>

Value:
UTIL_CAT(LOG_MSG_SIMPLE_ARG_TYPE_CHECK_, NUM_VA_ARGS_LESS_1(__VA_ARGS__))(__VA_ARGS__)

brief Determine if string arguments types allow to use simplified message creation mode.

Parameters
...String with arguments.

◆ LOG_MSG_SIMPLE_ARG_TYPE_CHECK_0

#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_0 ( fmt)

#include <zephyr/logging/log_msg.h>

Value:
1

◆ LOG_MSG_SIMPLE_ARG_TYPE_CHECK_1

#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_1 ( fmt,
arg )

#include <zephyr/logging/log_msg.h>

Value:
Z_CBPRINTF_IS_WORD_NUM(arg)

◆ LOG_MSG_SIMPLE_ARG_TYPE_CHECK_2

#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK_2 ( fmt,
arg0,
arg1 )

#include <zephyr/logging/log_msg.h>

Value:
Z_CBPRINTF_IS_WORD_NUM(arg0) && Z_CBPRINTF_IS_WORD_NUM(arg1)

◆ LOG_MSG_SIMPLE_CHECK

#define LOG_MSG_SIMPLE_CHECK ( ...)

#include <zephyr/logging/log_msg.h>

Value:
COND_CODE_1(CONFIG_64BIT, (0), (\
LOG_MSG_SIMPLE_ARG_TYPE_CHECK(__VA_ARGS__)), (0))))
#define LOG_MSG_SIMPLE_ARG_CNT_CHECK(...)
Definition log_msg.h:237
#define LOG_MSG_SIMPLE_ARG_TYPE_CHECK(...)
brief Determine if string arguments types allow to use simplified message creation mode.
Definition log_msg.h:250

Check if message can be handled using simplified method.

Following conditions must be met:

  • 32 bit platform
  • Number of arguments from 0 to 2
  • Type of an argument must be a numeric value that fits in 32 bit word.
Parameters
...String with arguments.
Return values
1if message qualifies.
0if message does not qualify.

◆ LOG_MSG_SIMPLE_FUNC

#define LOG_MSG_SIMPLE_FUNC ( _source,
_level,
... )

#include <zephyr/logging/log_msg.h>

Value:
Z_LOG_MSG_SIMPLE_FUNC2(NUM_VA_ARGS_LESS_1(__VA_ARGS__), _source, _level, __VA_ARGS__)

Call specific function to create a log message.

Macro picks matching function (based on number of arguments) and calls it. String arguments are casted to uint32_t.

Parameters
_sourceSource.
_levelSeverity level.
...String with arguments.

Function Documentation

◆ log_msg_generic_get_wlen()

static uint32_t log_msg_generic_get_wlen ( const union mpsc_pbuf_generic * item)
inlinestatic

#include <zephyr/logging/log_msg.h>

Get length of the log item.

Parameters
itemItem.
Returns
Length in 32 bit words.

◆ log_msg_get_data()

static uint8_t * log_msg_get_data ( struct log_msg * msg,
size_t * len )
inlinestatic

#include <zephyr/logging/log_msg.h>

Get data buffer.

Parameters
msglog message.
lenlocation where data length is written.
Returns
pointer to the data buffer.

◆ log_msg_get_domain()

static uint8_t log_msg_get_domain ( struct log_msg * msg)
inlinestatic

#include <zephyr/logging/log_msg.h>

Get log message domain ID.

Parameters
msgLog message.
Returns
Domain ID

◆ log_msg_get_level()

static uint8_t log_msg_get_level ( struct log_msg * msg)
inlinestatic

#include <zephyr/logging/log_msg.h>

Get log message level.

Parameters
msgLog message.
Returns
Log level.

◆ log_msg_get_package()

static uint8_t * log_msg_get_package ( struct log_msg * msg,
size_t * len )
inlinestatic

#include <zephyr/logging/log_msg.h>

Get string package.

Parameters
msglog message.
lenlocation where string package length is written.
Returns
pointer to the package.

◆ log_msg_get_source()

static const void * log_msg_get_source ( struct log_msg * msg)
inlinestatic

#include <zephyr/logging/log_msg.h>

Get message source data.

Parameters
msgLog message.
Returns
Pointer to the source data.

◆ log_msg_get_source_id()

int16_t log_msg_get_source_id ( struct log_msg * msg)

#include <zephyr/logging/log_msg.h>

Get log message source ID.

Parameters
msgLog message.
Returns
Source ID, or -1 if not available.

◆ log_msg_get_tid()

static void * log_msg_get_tid ( struct log_msg * msg)
inlinestatic

#include <zephyr/logging/log_msg.h>

Get Thread ID.

Parameters
msgLog message.
Returns
Thread ID.

◆ log_msg_get_timestamp()

static log_timestamp_t log_msg_get_timestamp ( struct log_msg * msg)
inlinestatic

#include <zephyr/logging/log_msg.h>

Get timestamp.

Parameters
msgLog message.
Returns
Timestamp.

◆ log_msg_get_total_wlen()

static uint32_t log_msg_get_total_wlen ( const struct log_msg_desc desc)
inlinestatic

#include <zephyr/logging/log_msg.h>

Get total length (in 32 bit words) of a log message.

Parameters
descLog message descriptor.
Returns
Length.