6#ifndef ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_H_
7#define ZEPHYR_INCLUDE_LOGGING_LOG_BACKEND_H_
40 const char *fmt, va_list ap);
69extern const struct log_backend __log_backends_start[];
70extern const struct log_backend __log_backends_end[];
81#define LOG_BACKEND_DEFINE(_name, _api, _autostart, ...) \
82 static struct log_backend_control_block UTIL_CAT(backend_cb_, _name) = \
84 COND_CODE_0(NUM_VA_ARGS_LESS_1(_, ##__VA_ARGS__), \
85 (), (.ctx = __VA_ARGS__,)) \
89 static const STRUCT_SECTION_ITERABLE(log_backend, _name) = \
92 .cb = &UTIL_CAT(backend_cb_, _name), \
93 .name = STRINGIFY(_name), \
94 .autostart = _autostart \
107 __ASSERT_NO_MSG(backend != NULL);
108 __ASSERT_NO_MSG(msg != NULL);
109 backend->
api->
put(backend, msg);
116 __ASSERT_NO_MSG(backend != NULL);
117 __ASSERT_NO_MSG(msg != NULL);
134 uint32_t timestamp,
const char *fmt,
137 __ASSERT_NO_MSG(backend != NULL);
158 uint32_t timestamp,
const char *metadata,
161 __ASSERT_NO_MSG(backend != NULL);
165 metadata,
data, len);
180 __ASSERT_NO_MSG(backend != NULL);
194 __ASSERT_NO_MSG(backend != NULL);
209 __ASSERT_NO_MSG(backend != NULL);
210 backend->
cb->
id = id;
223 __ASSERT_NO_MSG(backend != NULL);
224 return backend->
cb->
id;
236 return &__log_backends_start[idx];
246 return __log_backends_end - __log_backends_start;
258 __ASSERT_NO_MSG(backend != NULL);
259 backend->
cb->
ctx = ctx;
271 __ASSERT_NO_MSG(backend != NULL);
285 __ASSERT_NO_MSG(backend != NULL);
void
Definition: eswifi_shell.c:15
static void log_backend_deactivate(const struct log_backend *const backend)
Deactivate backend.
Definition: log_backend.h:268
static void log_backend_activate(const struct log_backend *const backend, void *ctx)
Activate backend.
Definition: log_backend.h:255
static bool log_backend_is_active(const struct log_backend *const backend)
Check state of the backend.
Definition: log_backend.h:282
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:104
static void log_backend_msg2_process(const struct log_backend *const backend, union log_msg2_generic *msg)
Definition: log_backend.h:112
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:131
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:155
static void log_backend_id_set(const struct log_backend *const backend, uint8_t id)
Set backend id.
Definition: log_backend.h:206
static void log_backend_dropped(const struct log_backend *const backend, uint32_t cnt)
Notify backend about dropped log messages.
Definition: log_backend.h:177
static int log_backend_count_get(void)
Get number of backends.
Definition: log_backend.h:244
static void log_backend_panic(const struct log_backend *const backend)
Reconfigure backend to panic mode.
Definition: log_backend.h:192
static uint8_t log_backend_id_get(const struct log_backend *const backend)
Get backend id.
Definition: log_backend.h:221
static const struct log_backend * log_backend_get(uint32_t idx)
Get backend.
Definition: log_backend.h:234
__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:46
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:38
void(* dropped)(const struct log_backend *const backend, uint32_t cnt)
Definition: log_backend.h:45
void(* process)(const struct log_backend *const backend, union log_msg2_generic *msg)
Definition: log_backend.h:33
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:41
void(* init)(const struct log_backend *const backend)
Definition: log_backend.h:47
void(* put)(const struct log_backend *const backend, struct log_msg *msg)
Definition: log_backend.h:36
Logger backend control block.
Definition: log_backend.h:53
uint8_t id
Definition: log_backend.h:55
bool active
Definition: log_backend.h:56
void * ctx
Definition: log_backend.h:54
Logger backend structure.
Definition: log_backend.h:62
const char * name
Definition: log_backend.h:65
const struct log_backend_api * api
Definition: log_backend.h:63
struct log_backend_control_block * cb
Definition: log_backend.h:64
bool autostart
Definition: log_backend.h:66
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
Definition: log_msg2.h:114