Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
#include <logging/log_msg.h>
#include <logging/log_core2.h>
#include <logging/log_instance.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdarg.h>
#include <syscall.h>
#include <sys/util.h>
#include <syscalls/log_core.h>
Go to the source code of this file.
Macros | |
#define | LOG_LEVEL_NONE 0U |
#define | LOG_LEVEL_ERR 1U |
#define | LOG_LEVEL_WRN 2U |
#define | LOG_LEVEL_INF 3U |
#define | LOG_LEVEL_DBG 4U |
#define | CONFIG_LOG_DEFAULT_LEVEL 0U |
#define | CONFIG_LOG_MAX_LEVEL 0U |
#define | CONFIG_LOG_DOMAIN_ID 0U |
#define | LOG_FUNCTION_PREFIX_MASK |
#define | LOG_CONST_ID_GET(_addr) COND_CODE_1(CONFIG_LOG, ((__log_level ? log_const_source_id(_addr) : 0)), (0)) |
Macro for getting ID of the element of the section. More... | |
#define | LOG_CURRENT_MODULE_ID() |
Macro for getting ID of current module. More... | |
#define | LOG_CURRENT_DYNAMIC_DATA_ADDR() |
Macro for getting address of dynamic structure of current module. More... | |
#define | LOG_DYNAMIC_ID_GET(_addr) COND_CODE_1(CONFIG_LOG, ((__log_level ? log_dynamic_source_id(_addr) : 0)), (0)) |
Macro for getting ID of the element of the section. More... | |
#define | LOG_LEVEL_BITS 3U |
Number of bits used to encode log level. More... | |
#define | LOG_FILTER_SLOT_SIZE LOG_LEVEL_BITS |
Filter slot size. More... | |
#define | LOG_FILTERS_NUM_OF_SLOTS (32 / LOG_FILTER_SLOT_SIZE) |
Number of slots in one word. More... | |
#define | LOG_FILTER_SLOT_MASK (BIT(LOG_FILTER_SLOT_SIZE) - 1U) |
Slot mask. More... | |
#define | LOG_FILTER_SLOT_SHIFT(_id) (LOG_FILTER_SLOT_SIZE * (_id)) |
Bit offset of a slot. More... | |
#define | LOG_FILTER_SLOT_GET(_filters, _id) ((*(_filters) >> LOG_FILTER_SLOT_SHIFT(_id)) & LOG_FILTER_SLOT_MASK) |
#define | LOG_FILTER_SLOT_SET(_filters, _id, _filter) |
#define | LOG_FILTER_AGGR_SLOT_IDX 0 |
#define | LOG_FILTER_AGGR_SLOT_GET(_filters) LOG_FILTER_SLOT_GET(_filters, LOG_FILTER_AGGR_SLOT_IDX) |
#define | LOG_FILTER_FIRST_BACKEND_SLOT_IDX 1 |
#define | LOG_LEVEL_INTERNAL_RAW_STRING LOG_LEVEL_NONE |
Log level value used to indicate log entry that should not be formatted (raw string). More... | |
#define | LOG_ITEM_DYNAMIC_DATA(_name) UTIL_CAT(log_dynamic_, _name) |
Creates name of variable and section for runtime log data. More... | |
#define | LOG_INSTANCE_DYNAMIC_DATA(_module_name, _inst) LOG_ITEM_DYNAMIC_DATA(LOG_INSTANCE_FULL_NAME(_module_name, _inst)) |
Enumerations | |
enum | log_strdup_action { LOG_STRDUP_SKIP , LOG_STRDUP_EXEC , LOG_STRDUP_CHECK_EXEC } |
Enum with possible actions for strdup operation. More... | |
Functions | |
static const char * | log_name_get (uint32_t source_id) |
Get name of the log source. More... | |
static uint8_t | log_compiled_level_get (uint32_t source_id) |
Get compiled level of the log source. More... | |
static uint32_t | log_const_source_id (const struct log_source_const_data *data) |
Get index of the log source based on the address of the constant data associated with the source. More... | |
static uint32_t | log_sources_count (void) |
Get number of registered sources. More... | |
static uint32_t * | log_dynamic_filters_get (uint32_t source_id) |
Get pointer to the filter set of the log source. More... | |
static uint32_t | log_dynamic_source_id (struct log_source_dynamic_data *data) |
Get index of the log source based on the address of the dynamic data associated with the source. More... | |
void | log_0 (const char *str, struct log_msg_ids src_level) |
Standard log with no arguments. More... | |
void | log_1 (const char *str, log_arg_t arg1, struct log_msg_ids src_level) |
Standard log with one argument. More... | |
void | log_2 (const char *str, log_arg_t arg1, log_arg_t arg2, struct log_msg_ids src_level) |
Standard log with two arguments. More... | |
void | log_3 (const char *str, log_arg_t arg1, log_arg_t arg2, log_arg_t arg3, struct log_msg_ids src_level) |
Standard log with three arguments. More... | |
void | log_n (const char *str, log_arg_t *args, uint32_t narg, struct log_msg_ids src_level) |
Standard log with arguments list. More... | |
void | log_hexdump (const char *str, const void *data, uint32_t length, struct log_msg_ids src_level) |
Hexdump log. More... | |
void | log_string_sync (struct log_msg_ids src_level, const char *fmt,...) |
Process log message synchronously. More... | |
void | log_hexdump_sync (struct log_msg_ids src_level, const char *metadata, const void *data, uint32_t len) |
Process log hexdump message synchronously. More... | |
void | log_generic (struct log_msg_ids src_level, const char *fmt, va_list ap, enum log_strdup_action strdup_action) |
Writes a generic log message to the log. More... | |
static void | log2_generic (uint8_t level, const char *fmt, va_list ap) |
Writes a generic log message to the logging v2. More... | |
uint32_t | log_count_args (const char *fmt) |
Returns number of arguments visible from format string. More... | |
void | log_generic_from_user (struct log_msg_ids src_level, const char *fmt, va_list ap) |
Writes a generic log message to the log from user mode. More... | |
bool | log_is_strdup (const void *buf) |
Check if address belongs to the memory pool used for transient. More... | |
void | log_free (void *buf) |
Free allocated buffer. More... | |
uint32_t | log_get_strdup_pool_current_utilization (void) |
Get current number of allocated buffers for string duplicates. More... | |
uint32_t | log_get_strdup_pool_utilization (void) |
Get maximal number of simultaneously allocated buffers for string duplicates. More... | |
uint32_t | log_get_strdup_longest_string (void) |
Get length of the longest string duplicated. More... | |
void | log_from_user (struct log_msg_ids src_level, const char *fmt,...) |
Log a message from user mode context. More... | |
void | log_hexdump_from_user (struct log_msg_ids src_level, const char *metadata, const void *data, uint32_t len) |
Log binary data (displayed as hexdump) from user mode context. More... | |
#define CONFIG_LOG_DEFAULT_LEVEL 0U |
#define CONFIG_LOG_DOMAIN_ID 0U |
#define CONFIG_LOG_MAX_LEVEL 0U |
#define LOG_CONST_ID_GET | ( | _addr | ) | COND_CODE_1(CONFIG_LOG, ((__log_level ? log_const_source_id(_addr) : 0)), (0)) |
Macro for getting ID of the element of the section.
_addr | Address of the element. |
#define LOG_CURRENT_DYNAMIC_DATA_ADDR | ( | ) |
Macro for getting address of dynamic structure of current module.
#define LOG_CURRENT_MODULE_ID | ( | ) |
Macro for getting ID of current module.
#define LOG_DYNAMIC_ID_GET | ( | _addr | ) | COND_CODE_1(CONFIG_LOG, ((__log_level ? log_dynamic_source_id(_addr) : 0)), (0)) |
Macro for getting ID of the element of the section.
_addr | Address of the element. |
#define LOG_FILTER_AGGR_SLOT_GET | ( | _filters | ) | LOG_FILTER_SLOT_GET(_filters, LOG_FILTER_AGGR_SLOT_IDX) |
#define LOG_FILTER_AGGR_SLOT_IDX 0 |
#define LOG_FILTER_FIRST_BACKEND_SLOT_IDX 1 |
#define LOG_FILTER_SLOT_GET | ( | _filters, | |
_id | |||
) | ((*(_filters) >> LOG_FILTER_SLOT_SHIFT(_id)) & LOG_FILTER_SLOT_MASK) |
#define LOG_FILTER_SLOT_MASK (BIT(LOG_FILTER_SLOT_SIZE) - 1U) |
Slot mask.
#define LOG_FILTER_SLOT_SET | ( | _filters, | |
_id, | |||
_filter | |||
) |
#define LOG_FILTER_SLOT_SHIFT | ( | _id | ) | (LOG_FILTER_SLOT_SIZE * (_id)) |
Bit offset of a slot.
_id | Slot ID. |
#define LOG_FILTER_SLOT_SIZE LOG_LEVEL_BITS |
Filter slot size.
#define LOG_FILTERS_NUM_OF_SLOTS (32 / LOG_FILTER_SLOT_SIZE) |
Number of slots in one word.
#define LOG_FUNCTION_PREFIX_MASK |
#define LOG_INSTANCE_DYNAMIC_DATA | ( | _module_name, | |
_inst | |||
) | LOG_ITEM_DYNAMIC_DATA(LOG_INSTANCE_FULL_NAME(_module_name, _inst)) |
#define LOG_ITEM_DYNAMIC_DATA | ( | _name | ) | UTIL_CAT(log_dynamic_, _name) |
Creates name of variable and section for runtime log data.
_name | Name. |
#define LOG_LEVEL_BITS 3U |
Number of bits used to encode log level.
#define LOG_LEVEL_DBG 4U |
#define LOG_LEVEL_ERR 1U |
#define LOG_LEVEL_INF 3U |
#define LOG_LEVEL_INTERNAL_RAW_STRING LOG_LEVEL_NONE |
Log level value used to indicate log entry that should not be formatted (raw string).
#define LOG_LEVEL_NONE 0U |
#define LOG_LEVEL_WRN 2U |
enum log_strdup_action |
Writes a generic log message to the logging v2.
level | Log level.. |
fmt | String to format. |
ap | Poiner to arguments list. |
void log_0 | ( | const char * | str, |
struct log_msg_ids | src_level | ||
) |
Standard log with no arguments.
str | String. |
src_level | Log identification. |
void log_1 | ( | const char * | str, |
log_arg_t | arg1, | ||
struct log_msg_ids | src_level | ||
) |
Standard log with one argument.
str | String. |
arg1 | First argument. |
src_level | Log identification. |
void log_2 | ( | const char * | str, |
log_arg_t | arg1, | ||
log_arg_t | arg2, | ||
struct log_msg_ids | src_level | ||
) |
Standard log with two arguments.
str | String. |
arg1 | First argument. |
arg2 | Second argument. |
src_level | Log identification. |
void log_3 | ( | const char * | str, |
log_arg_t | arg1, | ||
log_arg_t | arg2, | ||
log_arg_t | arg3, | ||
struct log_msg_ids | src_level | ||
) |
Standard log with three arguments.
str | String. |
arg1 | First argument. |
arg2 | Second argument. |
arg3 | Third argument. |
src_level | Log identification. |
Get compiled level of the log source.
source_id | Source ID. |
|
inlinestatic |
Get index of the log source based on the address of the constant data associated with the source.
data | Address of the constant data. |
uint32_t log_count_args | ( | const char * | fmt | ) |
Returns number of arguments visible from format string.
fmt | Format string. |
Get pointer to the filter set of the log source.
source_id | Source ID. |
|
inlinestatic |
Get index of the log source based on the address of the dynamic data associated with the source.
data | Address of the dynamic data. |
void log_from_user | ( | struct log_msg_ids | src_level, |
const char * | fmt, | ||
... | |||
) |
Log a message from user mode context.
src_level | Log identification. |
fmt | String to format. |
... | Variable list of arguments. |
void log_generic | ( | struct log_msg_ids | src_level, |
const char * | fmt, | ||
va_list | ap, | ||
enum log_strdup_action | strdup_action | ||
) |
Writes a generic log message to the log.
src_level | Log identification. |
fmt | String to format. |
ap | Poiner to arguments list. |
strdup_action | Manages strdup activity. |
void log_generic_from_user | ( | struct log_msg_ids | src_level, |
const char * | fmt, | ||
va_list | ap | ||
) |
Writes a generic log message to the log from user mode.
Get length of the longest string duplicated.
Value can be used to determine buffer size in the string duplicates pool.
Get current number of allocated buffers for string duplicates.
Get maximal number of simultaneously allocated buffers for string duplicates.
Value can be used to determine pool size.
void log_hexdump | ( | const char * | str, |
const void * | data, | ||
uint32_t | length, | ||
struct log_msg_ids | src_level | ||
) |
Hexdump log.
str | String. |
data | Data. |
length | Data length. |
src_level | Log identification. |
void log_hexdump_from_user | ( | struct log_msg_ids | src_level, |
const char * | metadata, | ||
const void * | data, | ||
uint32_t | len | ||
) |
Log binary data (displayed as hexdump) from user mode context.
src_level | Log identification. |
metadata | Raw string associated with the data. |
data | Data. |
len | Data length. |
void log_hexdump_sync | ( | struct log_msg_ids | src_level, |
const char * | metadata, | ||
const void * | data, | ||
uint32_t | len | ||
) |
Process log hexdump message synchronously.
src_level | Log message details. |
metadata | Raw string associated with the data. |
data | Data. |
len | Data length. |
Check if address belongs to the memory pool used for transient.
buf | Buffer. |
void log_n | ( | const char * | str, |
log_arg_t * | args, | ||
uint32_t | narg, | ||
struct log_msg_ids | src_level | ||
) |
Standard log with arguments list.
str | String. |
args | Array with arguments. |
narg | Number of arguments in the array. |
src_level | Log identification. |
|
inlinestatic |
Get name of the log source.
source_id | Source ID. |
void log_string_sync | ( | struct log_msg_ids | src_level, |
const char * | fmt, | ||
... | |||
) |
Process log message synchronously.
src_level | Log message details. |
fmt | String to format. |
... | Variable list of arguments. |