Expand description
The LogSink that speaks the platform ABI.
§Why it lives here and not in the facade
nros-log is a facade: LogSink + init exist so delivery is PLUGGABLE.
PlatformSink is one bridge among possible many — it is the only one that
needs nros_platform_log_write, which is a LINK-TIME requirement on the
final binary.
While it lived in nros-log, “does this binary need the platform log ABI?”
was answerable only by a Cargo feature, and issue 0710 showed that cannot
work: nros-platform-cffi and nros-rmw-bridge enable
nros-node/rmw-cffi unconditionally, so workspace feature unification
turns any forwarded gate back ON for every member of the build. A feature is
a property of the BUILD.
A DEPENDENCY is a property of the binary. Here, the question answers itself:
a binary that links this crate has the ABI (that is what this crate is), and
one that does not cannot accidentally acquire the requirement. The extern is
also declared exactly once now, in generated.rs — bindgen output from
<nros/platform.h>, the SSoT per RFC-0054 — rather than a second time by
hand in the facade.
§Using it
nros_log::init(nros_platform_cffi::log::default_sinks());
// or, equivalently:
nros_platform_cffi::log::init_default();Apps wanting fan-out (e.g. platform + /rosout) compose their own
&'static [&dyn LogSink] and pass it to nros_log::init, exactly as before.
Structs§
- Platform
Sink - Forwards every record to the platform port’s
nros_platform_log_write.
Functions§
- default_
sinks - The default sink list: just
PlatformSink. - init_
default - Install
default_sinksas the global sink list.