Nexus Embedded Platform 1.0.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1
6#ifndef NEXUS_COMPONENTS_LOG_H
7#define NEXUS_COMPONENTS_LOG_H
8#include "nexus/core/time.h"
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
21
30typedef struct {
31 void* context;
32 nx_result_t (*write)(void*, nx_log_level_t, const void*, size_t,
33 nx_time_us_t deadline);
34 nx_result_t (*flush)(void*, nx_time_us_t deadline);
36
47
56 nx_log_level_t minimum);
76 const void* bytes, size_t length,
77 nx_time_us_t deadline);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* NEXUS_COMPONENTS_LOG_H */
nx_result_t nx_log_flush(nx_log_t *logger, nx_time_us_t deadline)
Flush an explicit sink without creating a background worker.
nx_result_t nx_log_stop(nx_log_t *logger)
Reject new writes and test whether the sink has exited.
nx_log_level_t
Structured severity, with filtering before touching a sink.
Definition log.h:15
@ NX_LOG_WARNING
Definition log.h:18
@ NX_LOG_INFO
Definition log.h:17
@ NX_LOG_ERROR
Definition log.h:19
@ NX_LOG_DEBUG
Definition log.h:16
nx_result_t nx_log_init(nx_log_t *logger, nx_log_sink_port_t sink, nx_log_level_t minimum)
Initialize an unused logger before exposing it to tasks.
nx_result_t nx_log_write(nx_log_t *logger, nx_log_level_t level, const void *bytes, size_t length, nx_time_us_t deadline)
Write caller bytes, with no implicit allocation/formatting.
nx_result_t
Operation result; success at submission means admission only.
Definition status.h:21
Synchronous caller-injected sink.
Definition log.h:30
void * context
Definition log.h:31
nx_result_t(* write)(void *, nx_log_level_t, const void *, size_t, nx_time_us_t deadline)
Definition log.h:32
nx_result_t(* flush)(void *, nx_time_us_t deadline)
Definition log.h:34
Logger storage belongs to its caller; shared immutable port is copied.
Definition log.h:41
uint32_t busy
Definition log.h:44
uint32_t stopped
Definition log.h:45
nx_log_level_t minimum
Definition log.h:43
nx_log_sink_port_t sink
Definition log.h:42
Absolute monotonic microsecond deadlines and wrap extension.
uint64_t nx_time_us_t
Microseconds in one boot/clock domain; no wall-clock semantics.
Definition time.h:20