Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Logger API. More...
Macros | |
#define | LOG_ERR(...) Z_LOG(LOG_LEVEL_ERR, __VA_ARGS__) |
Writes an ERROR level message to the log. | |
#define | LOG_WRN(...) Z_LOG(LOG_LEVEL_WRN, __VA_ARGS__) |
Writes a WARNING level message to the log. | |
#define | LOG_INF(...) Z_LOG(LOG_LEVEL_INF, __VA_ARGS__) |
Writes an INFO level message to the log. | |
#define | LOG_DBG(...) Z_LOG(LOG_LEVEL_DBG, __VA_ARGS__) |
Writes a DEBUG level message to the log. | |
#define | LOG_WRN_ONCE(...) |
Writes a WARNING level message to the log on the first execution only. | |
#define | LOG_PRINTK(...) Z_LOG_PRINTK(0, __VA_ARGS__) |
Unconditionally print raw log message. | |
#define | LOG_RAW(...) Z_LOG_PRINTK(1, __VA_ARGS__) |
Unconditionally print raw log message. | |
#define | LOG_INST_ERR(_log_inst, ...) Z_LOG_INSTANCE(LOG_LEVEL_ERR, _log_inst, __VA_ARGS__) |
Writes an ERROR level message associated with the instance to the log. | |
#define | LOG_INST_WRN(_log_inst, ...) Z_LOG_INSTANCE(LOG_LEVEL_WRN, _log_inst, __VA_ARGS__) |
Writes a WARNING level message associated with the instance to the log. | |
#define | LOG_INST_INF(_log_inst, ...) Z_LOG_INSTANCE(LOG_LEVEL_INF, _log_inst, __VA_ARGS__) |
Writes an INFO level message associated with the instance to the log. | |
#define | LOG_INST_DBG(_log_inst, ...) Z_LOG_INSTANCE(LOG_LEVEL_DBG, _log_inst, __VA_ARGS__) |
Writes a DEBUG level message associated with the instance to the log. | |
#define | LOG_HEXDUMP_ERR(_data, _length, _str) Z_LOG_HEXDUMP(LOG_LEVEL_ERR, _data, _length, (_str)) |
Writes an ERROR level hexdump message to the log. | |
#define | LOG_HEXDUMP_WRN(_data, _length, _str) Z_LOG_HEXDUMP(LOG_LEVEL_WRN, _data, _length, (_str)) |
Writes a WARNING level message to the log. | |
#define | LOG_HEXDUMP_INF(_data, _length, _str) Z_LOG_HEXDUMP(LOG_LEVEL_INF, _data, _length, (_str)) |
Writes an INFO level message to the log. | |
#define | LOG_HEXDUMP_DBG(_data, _length, _str) Z_LOG_HEXDUMP(LOG_LEVEL_DBG, _data, _length, (_str)) |
Writes a DEBUG level message to the log. | |
#define | LOG_INST_HEXDUMP_ERR(_log_inst, _data, _length, _str) Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_ERR, _log_inst, _data, _length, _str) |
Writes an ERROR hexdump message associated with the instance to the log. | |
#define | LOG_INST_HEXDUMP_WRN(_log_inst, _data, _length, _str) Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_WRN, _log_inst, _data, _length, _str) |
Writes a WARNING level hexdump message associated with the instance to the log. | |
#define | LOG_INST_HEXDUMP_INF(_log_inst, _data, _length, _str) Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_INF, _log_inst, _data, _length, _str) |
Writes an INFO level hexdump message associated with the instance to the log. | |
#define | LOG_INST_HEXDUMP_DBG(_log_inst, _data, _length, _str) Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_DBG, _log_inst, _data, _length, _str) |
Writes a DEBUG level hexdump message associated with the instance to the log. | |
#define | LOG_MODULE_REGISTER(...) |
Create module-specific state and register the module with Logger. | |
#define | LOG_MODULE_DECLARE(...) |
Macro for declaring a log module (not registering it). | |
#define | LOG_LEVEL_SET(level) |
Macro for setting log level in the file or function where instance logging API is used. | |
Logger API.
#define LOG_DBG | ( | ... | ) | Z_LOG(LOG_LEVEL_DBG, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes a DEBUG level message to the log.
It's meant to write developer oriented information.
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_ERR | ( | ... | ) | Z_LOG(LOG_LEVEL_ERR, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes an ERROR level message to the log.
It's meant to report severe errors, such as those from which it's not possible to recover.
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_HEXDUMP_DBG | ( | _data, | |
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP(LOG_LEVEL_DBG, _data, _length, (_str)) |
#include <zephyr/logging/log.h>
Writes a DEBUG level message to the log.
It's meant to write developer oriented information.
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_HEXDUMP_ERR | ( | _data, | |
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP(LOG_LEVEL_ERR, _data, _length, (_str)) |
#include <zephyr/logging/log.h>
Writes an ERROR level hexdump message to the log.
It's meant to report severe errors, such as those from which it's not possible to recover.
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_HEXDUMP_INF | ( | _data, | |
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP(LOG_LEVEL_INF, _data, _length, (_str)) |
#include <zephyr/logging/log.h>
Writes an INFO level message to the log.
It's meant to write generic user oriented messages.
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_HEXDUMP_WRN | ( | _data, | |
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP(LOG_LEVEL_WRN, _data, _length, (_str)) |
#include <zephyr/logging/log.h>
Writes a WARNING level message to the log.
It's meant to register messages related to unusual situations that are not necessarily errors.
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_INF | ( | ... | ) | Z_LOG(LOG_LEVEL_INF, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes an INFO level message to the log.
It's meant to write generic user oriented messages.
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_INST_DBG | ( | _log_inst, | |
... | |||
) | Z_LOG_INSTANCE(LOG_LEVEL_DBG, _log_inst, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes a DEBUG level message associated with the instance to the log.
Message is associated with specific instance of the module which has independent filtering settings (if runtime filtering is enabled) and message prefix (<module_name>.<instance_name>). It's meant to write developer oriented information.
_log_inst | Pointer to the log structure associated with the instance. |
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_INST_ERR | ( | _log_inst, | |
... | |||
) | Z_LOG_INSTANCE(LOG_LEVEL_ERR, _log_inst, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes an ERROR level message associated with the instance to the log.
Message is associated with specific instance of the module which has independent filtering settings (if runtime filtering is enabled) and message prefix (<module_name>.<instance_name>). It's meant to report severe errors, such as those from which it's not possible to recover.
_log_inst | Pointer to the log structure associated with the instance. |
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_INST_HEXDUMP_DBG | ( | _log_inst, | |
_data, | |||
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_DBG, _log_inst, _data, _length, _str) |
#include <zephyr/logging/log.h>
Writes a DEBUG level hexdump message associated with the instance to the log.
It's meant to write developer oriented information.
_log_inst | Pointer to the log structure associated with the instance. |
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_INST_HEXDUMP_ERR | ( | _log_inst, | |
_data, | |||
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_ERR, _log_inst, _data, _length, _str) |
#include <zephyr/logging/log.h>
Writes an ERROR hexdump message associated with the instance to the log.
Message is associated with specific instance of the module which has independent filtering settings (if runtime filtering is enabled) and message prefix (<module_name>.<instance_name>). It's meant to report severe errors, such as those from which it's not possible to recover.
_log_inst | Pointer to the log structure associated with the instance. |
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_INST_HEXDUMP_INF | ( | _log_inst, | |
_data, | |||
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_INF, _log_inst, _data, _length, _str) |
#include <zephyr/logging/log.h>
Writes an INFO level hexdump message associated with the instance to the log.
It's meant to write generic user oriented messages.
_log_inst | Pointer to the log structure associated with the instance. |
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_INST_HEXDUMP_WRN | ( | _log_inst, | |
_data, | |||
_length, | |||
_str | |||
) | Z_LOG_HEXDUMP_INSTANCE(LOG_LEVEL_WRN, _log_inst, _data, _length, _str) |
#include <zephyr/logging/log.h>
Writes a WARNING level hexdump message associated with the instance to the log.
It's meant to register messages related to unusual situations that are not necessarily errors.
_log_inst | Pointer to the log structure associated with the instance. |
_data | Pointer to the data to be logged. |
_length | Length of data (in bytes). |
_str | Persistent, raw string. |
#define LOG_INST_INF | ( | _log_inst, | |
... | |||
) | Z_LOG_INSTANCE(LOG_LEVEL_INF, _log_inst, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes an INFO level message associated with the instance to the log.
Message is associated with specific instance of the module which has independent filtering settings (if runtime filtering is enabled) and message prefix (<module_name>.<instance_name>). It's meant to write generic user oriented messages.
_log_inst | Pointer to the log structure associated with the instance. |
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_INST_WRN | ( | _log_inst, | |
... | |||
) | Z_LOG_INSTANCE(LOG_LEVEL_WRN, _log_inst, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes a WARNING level message associated with the instance to the log.
Message is associated with specific instance of the module which has independent filtering settings (if runtime filtering is enabled) and message prefix (<module_name>.<instance_name>). It's meant to register messages related to unusual situations that are not necessarily errors.
_log_inst | Pointer to the log structure associated with the instance. |
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_LEVEL_SET | ( | level | ) |
#include <zephyr/logging/log.h>
Macro for setting log level in the file or function where instance logging API is used.
level | Level used in file or in function. |
#define LOG_MODULE_DECLARE | ( | ... | ) |
#include <zephyr/logging/log.h>
Macro for declaring a log module (not registering it).
Modules which are split up over multiple files must have exactly one file use LOG_MODULE_REGISTER() to create module-specific state and register the module with the logger core.
The other files in the module should use this macro instead to declare that same state. (Otherwise, LOG_INF() etc. will not be able to refer to module-specific state variables.)
Macro accepts one or two parameters:
Example usage:
#define LOG_MODULE_REGISTER | ( | ... | ) |
#include <zephyr/logging/log.h>
Create module-specific state and register the module with Logger.
This macro normally must be used after including <zephyr/logging/log.h> to complete the initialization of the module.
Module registration can be skipped in two cases:
Macro accepts one or two parameters:
Example usage:
#define LOG_PRINTK | ( | ... | ) | Z_LOG_PRINTK(0, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Unconditionally print raw log message.
The result is same as if printk was used but it goes through logging infrastructure thus utilizes logging mode, e.g. deferred mode.
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_RAW | ( | ... | ) | Z_LOG_PRINTK(1, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Unconditionally print raw log message.
Provided string is printed as is without appending any characters (e.g., color or newline).
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_WRN | ( | ... | ) | Z_LOG(LOG_LEVEL_WRN, __VA_ARGS__) |
#include <zephyr/logging/log.h>
Writes a WARNING level message to the log.
It's meant to register messages related to unusual situations that are not necessarily errors.
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |
#define LOG_WRN_ONCE | ( | ... | ) |
#include <zephyr/logging/log.h>
Writes a WARNING level message to the log on the first execution only.
It's meant for situations that warrant investigation but could clutter the logs if output on every execution.
... | A string optionally containing printk valid conversion specifier, followed by as many values as specifiers. |