6#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_H_
7#define ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_H_
42 const char *fmt, va_list ap);
72extern const struct log_backend __log_backends_start[];
73extern const struct log_backend __log_backends_end[];
84#define LOG_BACKEND_DEFINE(_name, _api, _autostart, ...) \
85 static struct log_backend_control_block UTIL_CAT(backend_cb_, _name) = \
87 COND_CODE_0(NUM_VA_ARGS_LESS_1(_, ##__VA_ARGS__), \
88 (), (.ctx = __VA_ARGS__,)) \
92 static const STRUCT_SECTION_ITERABLE(log_backend, _name) = \
95 .cb = &UTIL_CAT(backend_cb_, _name), \
96 .name = STRINGIFY(_name), \
97 .autostart = _autostart \
112 __ASSERT_NO_MSG(backend != NULL);
113 __ASSERT_NO_MSG(
msg != NULL);
130 __ASSERT_NO_MSG(backend != NULL);
131 __ASSERT_NO_MSG(
msg != NULL);
150 uint32_t timestamp,
const char *fmt,
153 __ASSERT_NO_MSG(backend != NULL);
176 uint32_t timestamp,
const char *metadata,
179 __ASSERT_NO_MSG(backend != NULL);
183 metadata,
data, len);
198 __ASSERT_NO_MSG(backend != NULL);
212 __ASSERT_NO_MSG(backend != NULL);
227 __ASSERT_NO_MSG(backend != NULL);
228 backend->
cb->
id = id;
241 __ASSERT_NO_MSG(backend != NULL);
242 return backend->
cb->
id;
254 return &__log_backends_start[idx];
264 return __log_backends_end - __log_backends_start;
276 __ASSERT_NO_MSG(backend != NULL);
277 backend->
cb->
ctx = ctx;
289 __ASSERT_NO_MSG(backend != NULL);
303 __ASSERT_NO_MSG(backend != NULL);
static void log_backend_deactivate(const struct log_backend *const backend)
Deactivate backend.
Definition: log_backend.h:286
static void log_backend_activate(const struct log_backend *const backend, void *ctx)
Activate backend.
Definition: log_backend.h:273
static bool log_backend_is_active(const struct log_backend *const backend)
Check state of the backend.
Definition: log_backend.h:300
static void log_backend_put(const struct log_backend *const backend, struct log_msg *msg)
Put message with log entry to the backend.
Definition: log_backend.h:109
static void log_backend_msg2_process(const struct log_backend *const backend, union log_msg2_generic *msg)
Process message.
Definition: log_backend.h:126
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.
Definition: log_backend.h:147
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.
Definition: log_backend.h:173
static void log_backend_id_set(const struct log_backend *const backend, uint8_t id)
Set backend id.
Definition: log_backend.h:224
static void log_backend_dropped(const struct log_backend *const backend, uint32_t cnt)
Notify backend about dropped log messages.
Definition: log_backend.h:195
static int log_backend_count_get(void)
Get number of backends.
Definition: log_backend.h:262
static void log_backend_panic(const struct log_backend *const backend)
Reconfigure backend to panic mode.
Definition: log_backend.h:210
static uint8_t log_backend_id_get(const struct log_backend *const backend)
Get backend id.
Definition: log_backend.h:239
static const struct log_backend * log_backend_get(uint32_t idx)
Get backend.
Definition: log_backend.h:252
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Logger backend API.
Definition: log_backend.h:32
void(* panic)(const struct log_backend *const backend)
Definition: log_backend.h:49
void(* put_sync_string)(const struct log_backend *const backend, struct log_msg_ids src_level, uint32_t timestamp, const char *fmt, va_list ap)
Definition: log_backend.h:40
void(* dropped)(const struct log_backend *const backend, uint32_t cnt)
Definition: log_backend.h:48
void(* process)(const struct log_backend *const backend, union log_msg2_generic *msg)
Definition: log_backend.h:34
void(* 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)
Definition: log_backend.h:43
void(* init)(const struct log_backend *const backend)
Definition: log_backend.h:50
void(* put)(const struct log_backend *const backend, struct log_msg *msg)
Definition: log_backend.h:38
Logger backend control block.
Definition: log_backend.h:56
uint8_t id
Definition: log_backend.h:58
bool active
Definition: log_backend.h:59
void * ctx
Definition: log_backend.h:57
Logger backend structure.
Definition: log_backend.h:65
const char * name
Definition: log_backend.h:68
const struct log_backend_api * api
Definition: log_backend.h:66
struct log_backend_control_block * cb
Definition: log_backend.h:67
bool autostart
Definition: log_backend.h:69
Part of log message header identifying source and level.
Definition: log_msg.h:85
Log message structure.
Definition: log_msg.h:139
static fdata_t data[2]
Definition: test_fifo_contexts.c:15
static void msg(uint64_t c64)
Definition: main.c:17
Definition: log_msg2.h:94