Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Log message API. More...
Data Structures | |
struct | log_msg_ids |
Part of log message header identifying source and level. More... | |
struct | log_msg_generic_hdr |
struct | log_msg_std_hdr |
struct | log_msg_hexdump_hdr |
struct | log_msg_hdr |
union | log_msg_head_data |
Data part of log message. More... | |
struct | log_msg_ext_head_data |
Data part of extended log message. More... | |
struct | log_msg |
Log message structure. More... | |
struct | log_msg_cont |
Chunks following message head when message is extended. More... | |
union | log_msg_chunk |
Log message. More... | |
Macros | |
#define | LOG_MAX_NARGS 15 |
Maximum number of arguments in the standard log entry. More... | |
#define | LOG_MSG_NARGS_SINGLE_CHUNK 3U |
Number of arguments in the log entry which fits in one chunk. More... | |
#define | LOG_MSG_NARGS_HEAD_CHUNK (LOG_MSG_NARGS_SINGLE_CHUNK - (sizeof(void *)/sizeof(log_arg_t))) |
Number of arguments in the head of extended standard log message.. More... | |
#define | LOG_MSG_HEXDUMP_BYTES_SINGLE_CHUNK (LOG_MSG_NARGS_SINGLE_CHUNK * sizeof(log_arg_t)) |
Maximal amount of bytes in the hexdump entry which fits in one chunk. More... | |
#define | LOG_MSG_HEXDUMP_BYTES_HEAD_CHUNK (LOG_MSG_HEXDUMP_BYTES_SINGLE_CHUNK - sizeof(void *)) |
Number of bytes in the first chunk of hexdump message if message consists of more than one chunk. More... | |
#define | HEXDUMP_BYTES_CONT_MSG (sizeof(struct log_msg) - sizeof(void *)) |
Number of bytes that can be stored in chunks following head chunk in hexdump log message. More... | |
#define | ARGS_CONT_MSG (HEXDUMP_BYTES_CONT_MSG / sizeof(log_arg_t)) |
#define | LOG_MSG_TYPE_STD 0U |
Flag indicating standard log message. More... | |
#define | LOG_MSG_TYPE_HEXDUMP 1 |
Flag indicating hexdump log message. More... | |
#define | COMMON_PARAM_HDR() |
Common part of log message header. More... | |
#define | LOG_MSG_HEXDUMP_LENGTH_BITS 14 |
Number of bits used for storing length of hexdump log message. More... | |
#define | LOG_MSG_HEXDUMP_MAX_LENGTH (BIT(LOG_MSG_HEXDUMP_LENGTH_BITS) - 1) |
Maximum length of log hexdump message. More... | |
Typedefs | |
typedef unsigned long | log_arg_t |
Log argument type. More... | |
Functions | |
void | log_msg_pool_init (void) |
Function for initialization of the log message pool. More... | |
void | log_msg_get (struct log_msg *msg) |
Function for indicating that message is in use. More... | |
void | log_msg_put (struct log_msg *msg) |
Function for indicating that message is no longer in use. More... | |
static uint32_t | log_msg_domain_id_get (struct log_msg *msg) |
Get domain ID of the message. More... | |
static uint32_t | log_msg_source_id_get (struct log_msg *msg) |
Get source ID (module or instance) of the message. More... | |
static uint32_t | log_msg_level_get (struct log_msg *msg) |
Get severity level of the message. More... | |
static uint32_t | log_msg_timestamp_get (struct log_msg *msg) |
Get timestamp of the message. More... | |
static bool | log_msg_is_std (struct log_msg *msg) |
Check if message is of standard type. More... | |
uint32_t | log_msg_nargs_get (struct log_msg *msg) |
Returns number of arguments in standard log message. More... | |
log_arg_t | log_msg_arg_get (struct log_msg *msg, uint32_t arg_idx) |
Gets argument from standard log message. More... | |
const char * | log_msg_str_get (struct log_msg *msg) |
Gets pointer to the unformatted string from standard log message. More... | |
struct log_msg * | log_msg_hexdump_create (const char *str, const uint8_t *data, uint32_t length) |
Allocates chunks for hexdump message and copies the data. More... | |
void | log_msg_hexdump_data_put (struct log_msg *msg, uint8_t *data, size_t *length, size_t offset) |
Put data into hexdump log message. More... | |
void | log_msg_hexdump_data_get (struct log_msg *msg, uint8_t *data, size_t *length, size_t offset) |
Get data from hexdump log message. More... | |
union log_msg_chunk * | log_msg_no_space_handle (void) |
union log_msg_chunk * | log_msg_chunk_alloc (void) |
Allocate single chunk from the pool. More... | |
static struct log_msg * | log_msg_create_0 (const char *str) |
Create standard log message with no arguments. More... | |
static struct log_msg * | log_msg_create_1 (const char *str, log_arg_t arg1) |
Create standard log message with one argument. More... | |
static struct log_msg * | log_msg_create_2 (const char *str, log_arg_t arg1, log_arg_t arg2) |
Create standard log message with two arguments. More... | |
static struct log_msg * | log_msg_create_3 (const char *str, log_arg_t arg1, log_arg_t arg2, log_arg_t arg3) |
Create standard log message with three arguments. More... | |
struct log_msg * | log_msg_create_n (const char *str, log_arg_t *args, uint32_t nargs) |
Create standard log message with variable number of arguments. More... | |
uint32_t | log_msg_mem_get_free (void) |
Get number of free blocks from the log mem pool. More... | |
uint32_t | log_msg_mem_get_used (void) |
Get number of used blocks from the log mem pool. More... | |
uint32_t | log_msg_mem_get_max_used (void) |
Get max used blocks from the log mem pool. More... | |
Log message API.
#define ARGS_CONT_MSG (HEXDUMP_BYTES_CONT_MSG / sizeof(log_arg_t)) |
#include <include/logging/log_msg.h>
#define COMMON_PARAM_HDR | ( | ) |
#include <include/logging/log_msg.h>
Common part of log message header.
#include <include/logging/log_msg.h>
Number of bytes that can be stored in chunks following head chunk in hexdump log message.
#define LOG_MAX_NARGS 15 |
#include <include/logging/log_msg.h>
Maximum number of arguments in the standard log entry.
It is limited by 4 bit nargs field in the log message.
#define LOG_MSG_HEXDUMP_BYTES_HEAD_CHUNK (LOG_MSG_HEXDUMP_BYTES_SINGLE_CHUNK - sizeof(void *)) |
#include <include/logging/log_msg.h>
Number of bytes in the first chunk of hexdump message if message consists of more than one chunk.
#define LOG_MSG_HEXDUMP_BYTES_SINGLE_CHUNK (LOG_MSG_NARGS_SINGLE_CHUNK * sizeof(log_arg_t)) |
#include <include/logging/log_msg.h>
Maximal amount of bytes in the hexdump entry which fits in one chunk.
#define LOG_MSG_HEXDUMP_LENGTH_BITS 14 |
#include <include/logging/log_msg.h>
Number of bits used for storing length of hexdump log message.
#define LOG_MSG_HEXDUMP_MAX_LENGTH (BIT(LOG_MSG_HEXDUMP_LENGTH_BITS) - 1) |
#include <include/logging/log_msg.h>
Maximum length of log hexdump message.
#define LOG_MSG_NARGS_HEAD_CHUNK (LOG_MSG_NARGS_SINGLE_CHUNK - (sizeof(void *)/sizeof(log_arg_t))) |
#include <include/logging/log_msg.h>
Number of arguments in the head of extended standard log message..
#define LOG_MSG_NARGS_SINGLE_CHUNK 3U |
#include <include/logging/log_msg.h>
Number of arguments in the log entry which fits in one chunk.
#define LOG_MSG_TYPE_HEXDUMP 1 |
#include <include/logging/log_msg.h>
Flag indicating hexdump log message.
#define LOG_MSG_TYPE_STD 0U |
#include <include/logging/log_msg.h>
Flag indicating standard log message.
#include <include/logging/log_msg.h>
Log argument type.
Should preferably be equivalent to a native word size.
#include <include/logging/log_msg.h>
Gets argument from standard log message.
msg | Standard log message. |
arg_idx | Argument index. |
union log_msg_chunk * log_msg_chunk_alloc | ( | void | ) |
#include <include/logging/log_msg.h>
Allocate single chunk from the pool.
|
inlinestatic |
#include <include/logging/log_msg.h>
Create standard log message with no arguments.
Function resets header and sets following fields:
#include <include/logging/log_msg.h>
Create standard log message with one argument.
Function resets header and sets following fields:
str | String. |
arg1 | Argument. |
|
inlinestatic |
#include <include/logging/log_msg.h>
Create standard log message with two arguments.
Function resets header and sets following fields:
str | String. |
arg1 | Argument 1. |
arg2 | Argument 2. |
|
inlinestatic |
#include <include/logging/log_msg.h>
Create standard log message with three arguments.
Function resets header and sets following fields:
str | String. |
arg1 | Argument 1. |
arg2 | Argument 2. |
arg3 | Argument 3. |
#include <include/logging/log_msg.h>
Create standard log message with variable number of arguments.
Function resets header and sets following fields:
str | String. |
args | Array with arguments. |
nargs | Number of arguments. |
#include <include/logging/log_msg.h>
Get domain ID of the message.
msg | Message |
#include <include/logging/log_msg.h>
Function for indicating that message is in use.
Message can be used (read) by multiple users. Internal reference counter is atomically increased. See log_msg_put.
msg | Message. |
#include <include/logging/log_msg.h>
Allocates chunks for hexdump message and copies the data.
Function resets header and sets following fields:
str | String. |
data | Data. |
length | Data length. |
void log_msg_hexdump_data_get | ( | struct log_msg * | msg, |
uint8_t * | data, | ||
size_t * | length, | ||
size_t | offset | ||
) |
#include <include/logging/log_msg.h>
Get data from hexdump log message.
[in] | msg | Message. |
[in] | data | Buffer for data. |
[in,out] | length | Input: requested amount. Output: actual amount. |
[in] | offset | Offset. |
void log_msg_hexdump_data_put | ( | struct log_msg * | msg, |
uint8_t * | data, | ||
size_t * | length, | ||
size_t | offset | ||
) |
#include <include/logging/log_msg.h>
Put data into hexdump log message.
[in] | msg | Message. |
[in] | data | Data to be copied. |
[in,out] | length | Input: requested amount. Output: actual amount. |
[in] | offset | Offset. |
#include <include/logging/log_msg.h>
Check if message is of standard type.
msg | Message |
true | Standard message. |
false | Hexdump message. |
#include <include/logging/log_msg.h>
Get severity level of the message.
msg | Message |
#include <include/logging/log_msg.h>
Get number of free blocks from the log mem pool.
#include <include/logging/log_msg.h>
Get max used blocks from the log mem pool.
#include <include/logging/log_msg.h>
Get number of used blocks from the log mem pool.
#include <include/logging/log_msg.h>
Returns number of arguments in standard log message.
msg | Standard log message. |
union log_msg_chunk * log_msg_no_space_handle | ( | void | ) |
#include <include/logging/log_msg.h>
#include <include/logging/log_msg.h>
Function for initialization of the log message pool.
#include <include/logging/log_msg.h>
Function for indicating that message is no longer in use.
Internal reference counter is atomically decreased. If reference counter equals 0 message is freed.
msg | Message. |
#include <include/logging/log_msg.h>
Get source ID (module or instance) of the message.
msg | Message |
const char * log_msg_str_get | ( | struct log_msg * | msg | ) |
#include <include/logging/log_msg.h>
Gets pointer to the unformatted string from standard log message.
msg | Standard log message. |
#include <include/logging/log_msg.h>
Get timestamp of the message.
msg | Message |