Logger backend interface.
More...
|
static void | log_backend_put (const struct log_backend *const backend, struct log_msg *msg) |
| Put message with log entry to the backend. More...
|
|
static void | log_backend_msg2_process (const struct log_backend *const backend, union log_msg2_generic *msg) |
|
static void | log_backend_put_sync_string (const struct log_backend *const backend, struct log_msg_ids src_level, uint32_t timestamp, const char *fmt, va_list ap) |
| Synchronously process log message. More...
|
|
static void | log_backend_put_sync_hexdump (const struct log_backend *const backend, struct log_msg_ids src_level, uint32_t timestamp, const char *metadata, const uint8_t *data, uint32_t len) |
| Synchronously process log hexdump_message. More...
|
|
static void | log_backend_dropped (const struct log_backend *const backend, uint32_t cnt) |
| Notify backend about dropped log messages. More...
|
|
static void | log_backend_panic (const struct log_backend *const backend) |
| Reconfigure backend to panic mode. More...
|
|
static void | log_backend_id_set (const struct log_backend *const backend, uint8_t id) |
| Set backend id. More...
|
|
static uint8_t | log_backend_id_get (const struct log_backend *const backend) |
| Get backend id. More...
|
|
static const struct log_backend * | log_backend_get (uint32_t idx) |
| Get backend. More...
|
|
static int | log_backend_count_get (void) |
| Get number of backends. More...
|
|
static void | log_backend_activate (const struct log_backend *const backend, void *ctx) |
| Activate backend. More...
|
|
static void | log_backend_deactivate (const struct log_backend *const backend) |
| Deactivate backend. More...
|
|
static bool | log_backend_is_active (const struct log_backend *const backend) |
| Check state of the backend. More...
|
|
Logger backend interface.
◆ LOG_BACKEND_DEFINE
#define LOG_BACKEND_DEFINE |
( |
|
_name, |
|
|
|
_api, |
|
|
|
_autostart, |
|
|
|
... |
|
) |
| |
#include <include/logging/log_backend.h>
Value:
{ \
(), (.
ctx = __VA_ARGS__,)) \
.id = 0, \
.active = false, \
}; \
{ \
.api = &_api, \
.autostart = _autostart \
}
#define STRINGIFY(s)
Definition: common.h:121
#define STRUCT_SECTION_ITERABLE(struct_type, name)
Defines a new iterable section.
Definition: common.h:199
#define NUM_VA_ARGS_LESS_1(...)
Number of arguments in the variable arguments list minus one.
Definition: util_macro.h:556
Logger backend control block.
Definition: log_backend.h:53
void * ctx
Definition: log_backend.h:54
Logger backend structure.
Definition: log_backend.h:62
#define UTIL_CAT(a,...)
Definition: util_internal.h:84
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_activate()
◆ 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 <include/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_get()
◆ log_backend_id_get()
#include <include/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 <include/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_is_active()
static bool log_backend_is_active |
( |
const struct log_backend *const |
backend | ) |
|
|
inlinestatic |
#include <include/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_msg2_process()
◆ log_backend_panic()
◆ log_backend_put()
#include <include/logging/log_backend.h>
Put message with log entry to the backend.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
[in] | msg | Pointer to message with log entry. |
◆ log_backend_put_sync_hexdump()
#include <include/logging/log_backend.h>
Synchronously process log hexdump_message.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
[in] | src_level | Message details. |
[in] | timestamp | Timestamp. |
[in] | metadata | Raw string associated with the data. |
[in] | data | Data. |
[in] | len | Data length. |
◆ log_backend_put_sync_string()
#include <include/logging/log_backend.h>
Synchronously process log message.
- Parameters
-
[in] | backend | Pointer to the backend instance. |
[in] | src_level | Message details. |
[in] | timestamp | Timestamp. |
[in] | fmt | Log string. |
[in] | ap | Log string arguments. |