Logger backend interface .
More...
|
#define | LOG_BACKEND_DEFINE(_name, _api, _autostart, ...) |
| Macro for creating a logger backend instance.
|
|
Logger backend interface .
◆ LOG_BACKEND_DEFINE
#define LOG_BACKEND_DEFINE |
( |
| _name, |
|
|
| _api, |
|
|
| _autostart, |
|
|
| ... ) |
#include <zephyr/logging/log_backend.h>
Value:
{ \
(), (.
ctx = __VA_ARGS__,)) \
.id = 0, \
.active = false, \
}; \
{ \
.api = &_api, \
.autostart = _autostart \
}
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition iterable_sections.h:216
#define NUM_VA_ARGS_LESS_1(...)
Number of arguments in the variable arguments list minus one.
Definition util_macro.h:647
Logger backend control block.
Definition log_backend.h:82
void * ctx
Definition log_backend.h:83
Logger backend structure.
Definition log_backend.h:94
#define UTIL_CAT(a,...)
Definition util_internal.h:104
Macro for creating a logger backend instance.
- Parameters
-
_name | Name of the backend instance. |
_api | Logger backend API. |
_autostart | If true backend is initialized and activated together with the logger subsystem. |
... | Optional context. |
◆ log_backend_evt
#include <zephyr/logging/log_backend.h>
Backend events.
Enumerator |
---|
LOG_BACKEND_EVT_PROCESS_THREAD_DONE | Event when process thread finishes processing.
This event is emitted when the process thread finishes processing pending log messages.
- Note
- This is not emitted when there are no pending log messages being processed.
-
Deferred mode only.
|
LOG_BACKEND_EVT_MAX | Maximum number of backend events.
|
◆ log_backend_activate()
static void log_backend_activate |
( |
const struct log_backend *const | backend, |
|
|
void * | ctx ) |
|
inlinestatic |
◆ log_backend_count_get()
static int log_backend_count_get |
( |
void | | ) |
|
|
inlinestatic |
◆ log_backend_deactivate()
static void log_backend_deactivate |
( |
const struct log_backend *const | backend | ) |
|
|
inlinestatic |
◆ log_backend_dropped()
#include <zephyr/logging/log_backend.h>
Notify backend about dropped log messages.
Function is optional.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
[in] | cnt | Number of dropped logs since last notification. |
◆ log_backend_format_set()
#include <zephyr/logging/log_backend.h>
Set logging format.
- Parameters
-
backend | Pointer to the backend instance. |
log_type | Log format. |
- Return values
-
-ENOTSUP | If the backend does not support changing format types. |
-EINVAL | If the input is invalid. |
0 | for success. |
◆ log_backend_get()
#include <zephyr/logging/log_backend.h>
Get backend.
- Parameters
-
[in] | idx | Pointer to the backend instance. |
- Returns
- Pointer to the backend instance.
◆ log_backend_id_get()
#include <zephyr/logging/log_backend.h>
Get backend id.
- Note
- It is used internally by the logger.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
- Returns
- Id.
◆ log_backend_id_set()
#include <zephyr/logging/log_backend.h>
Set backend id.
- Note
- It is used internally by the logger.
- Parameters
-
backend | Pointer to the backend instance. |
id | ID. |
◆ log_backend_init()
static void log_backend_init |
( |
const struct log_backend *const | backend | ) |
|
|
inlinestatic |
#include <zephyr/logging/log_backend.h>
Initialize or initiate the logging backend.
If backend initialization takes longer time it could block logging thread if backend is autostarted. That is because all backends are initialized in the context of the logging thread. In that case, backend shall provide function for polling for readiness (log_backend_is_ready).
- Parameters
-
[in] | backend | Pointer to the backend instance. |
◆ log_backend_is_active()
static bool log_backend_is_active |
( |
const struct log_backend *const | backend | ) |
|
|
inlinestatic |
#include <zephyr/logging/log_backend.h>
Check state of the backend.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
- Returns
- True if backend is active, false otherwise.
◆ log_backend_is_ready()
static int log_backend_is_ready |
( |
const struct log_backend *const | backend | ) |
|
|
inlinestatic |
#include <zephyr/logging/log_backend.h>
Poll for backend readiness.
If backend is ready immediately after initialization then backend may not provide this function.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
- Return values
-
0 | if backend is ready. |
-EBUSY | if backend is not yet ready. |
◆ log_backend_msg_process()
#include <zephyr/logging/log_backend.h>
Process message.
Function is used in deferred and immediate mode. On return, message content is processed by the backend and memory can be freed.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
[in] | msg | Pointer to message with log entry. |
◆ log_backend_notify()
#include <zephyr/logging/log_backend.h>
Notify a backend of an event.
- Parameters
-
backend | Pointer to the backend instance. |
event | Event to be notified. |
arg | Pointer to the argument(s). |
◆ log_backend_panic()
static void log_backend_panic |
( |
const struct log_backend *const | backend | ) |
|
|
inlinestatic |