69 const std::filesystem::path & path,
bool append = true);
Public API (issue #9): notifications and errors of the device layer.
Symbol visibility helpers.
The livox_mid360_core library: everything declared by the public headers.
Definition bytes.hpp:14
void set_log_handler(LogHandler handler)
Process-wide; safe to call while a Context is running.
LogHandler stderr_log_handler()
Writes format_log_record() + ' ' to stderr.
LogLevel log_level() noexcept
Current process-wide level, see set_log_level().
std::expected< LogHandler, DeviceError > file_log_handler(const std::filesystem::path &path, bool append=true)
Opens (creates or, with append, extends) path and returns a handler that writes format_log_record() +...
std::string format_log_record(const LogRecord &record)
2026-09-26T12:34:56.789Z W [serial] message (UTC, millisecond precision, one-letter level E/W/I/D/T,...
std::function< void(const LogRecord &)> LogHandler
Called from the Context receive thread, the Device worker thread and caller threads,...
Definition log.hpp:45
void set_log_level(LogLevel level) noexcept
Process-wide.
LogLevel
Severity, ordered: a level is emitted when it is <= the level set with set_log_level().
Definition log.hpp:25
@ kInfo
state transitions, reconnect attempts, host-setup replay, open / close
Definition log.hpp:29
@ kWarn
disconnects, command timeouts
Definition log.hpp:28
@ kDebug
request retries, datagrams from unknown sources
Definition log.hpp:30
@ kOff
default: nothing is emitted
Definition log.hpp:26
@ kTrace
reserved
Definition log.hpp:31
std::string_view to_string(Event::Kind kind) noexcept
Name of an event kind, e.g. "state_changed".
Errors of Context / Device. Session-level failures are wrapped, not re-encoded.
Definition event.hpp:128
One diagnostic record. The views are valid only during the handler call.
Definition log.hpp:36
std::string_view message
one line, no trailing newline, at most 255 bytes
Definition log.hpp:40
std::int64_t time_ns
system clock, nanoseconds since the Unix epoch
Definition log.hpp:38
LogLevel level
severity
Definition log.hpp:37
std::string_view serial_number
empty when the record is not device-scoped
Definition log.hpp:39