Skip to main content

Module log

Module log 

Source
Expand description

log::Log backend for oveRTOS.

Implements the log crate’s facade (log::Log) on top of the substrate’s ove_console_write and the binding’s FmtBuf stack buffer. Call init once at the start of ove_main, then use log::info!/log::warn!/log::error!/etc. like in any other Rust project.

Output format matches the legacy log_inf!/log_wrn!/log_err! macros (since-deleted), so a console log stream is byte-compatible with the C OVE_LOG_* family:

[I] message goes here
[W] warning goes here
[E] error goes here

Trace/Debug both render as [D] since the C side has no separate trace prefix.

§Buffer size and truncation

Each log::Log::log call allocates a 256-byte stack buffer (no heap dep). Messages longer than ~250 bytes (after prefix + newline) are silently truncated — the existing FmtBuf guarantees the buffer remains null-terminated and well-formed.

§Thread-safety

OveLogger is Sync because every Log::log call owns a fresh stack buffer — there is no shared mutable state. The underlying ove_console_write is the same primitive the C OVE_LOG_* macros call, so per-line atomicity is governed by the backend (POSIX writes to stderr atomically up to PIPE_BUF; FreeRTOS/Zephyr serialise via their console mutex).

Functions§

init
Install the oveRTOS console logger as the global log::Log impl.
try_init
Same as init but discards the “already-set” error.