nros_log/sinks.rs
1//! Sinks the FACADE itself can offer.
2//!
3//! issue 0710 — `PlatformSink` used to live here, and with it a hand-declared
4//! `unsafe extern "C" { nros_platform_log_write }`. Both moved to
5//! `nros_platform_cffi::log`, for a reason worth stating where the old code
6//! was:
7//!
8//! this crate is a facade. `LogSink` + [`crate::init`] exist so delivery is
9//! PLUGGABLE, and a sink that speaks the platform ABI is a LINK-TIME
10//! requirement on the final binary. While it lived here, "does this binary need
11//! that ABI?" was answerable only by a Cargo feature — and feature unification
12//! makes that unanswerable in a workspace build (`nros-platform-cffi` and
13//! `nros-rmw-bridge` enable `nros-node/rmw-cffi` unconditionally, so any
14//! forwarded gate is ON for every member). A dependency IS a property of the
15//! binary; a feature is a property of the build.
16//!
17//! It also means the extern is declared exactly once, in
18//! `nros-platform-cffi`'s bindgen output from `<nros/platform.h>` — the SSoT
19//! RFC-0054 names — rather than a second time by hand over here.
20//!
21//! Callers want:
22//!
23//! ```ignore
24//! nros_log::init(nros_platform_cffi::log::default_sinks());
25//! ```
26//!
27//! Records raised before any `init` are not lost: [`crate::early`] holds them
28//! and `init` drains them into whatever sinks arrive.