Expand description
rclrs’s log modifiers — log_info!(logger.once(), …),
.skip_first(), .throttle(d), .only_if(b) (phase-515 R3).
rclrs’s five level macros take anything implementing ToLogParams as
their first argument, so a modifier chains off the logger:
ⓘ
log_info!(logger.once(), "link up");
log_warn!(logger.skip_first().throttle(Duration::from_millis(500)), "lag {}", ms);
log_debug!(logger.only_if(verbose), "state {:?}", s);ADOPT-BOUNDED. rclrs’s names, with three stated differences:
ToLogParamsis implemented for&LoggerandLogParamsonly. rclrs also takes a node or a logger NAME; here a node’s logger isnode.logger(), and a name iscrate::get_logger.ThrottleClockhas one variant,SteadyTime: the platform’s monotonic clock is the only clock the logging path can read. rclrs’sSystemTimeandClock(…)have nothing to name here.- [
ToLogParams::throttle] and [ToLogParams::throttle_clock] exist only when the image has that clock (cfg(nros_log_clock), issue 1037). Without one the window would be measured against a constant and the call site would read like a working throttle while emitting once and then never (issue 1152), so a clockless build refuses.throttle(d)at compile time — the same refusal thenros_*_throttle!family makes, and thenros_*_throttle_at!family stays the clockless form.
The state once, skip_first and throttle need is NOT in the params
value. As in rclrs, the level macro declares it as statics at the call site
([crate::__nros_log_params_emit!]), which is what makes it per site. A
call site whose params are known at compile time to need neither — every
plain log_info!(logger, …) — references neither static once optimised,
and they are dropped with the dead branch.
Structs§
- LogParams
- rclrs’s
LogParams: the logger plus the modifiers one record carries.
Enums§
- LogOccurrence
- rclrs’s
LogOccurrence: which records of a call site emit. - Throttle
Clock - rclrs’s
ThrottleClock: the clock a throttle window is measured on.
Traits§
- ToLog
Params - rclrs’s
ToLogParams: anything a level macro takes as its first argument, and the modifiers that chain off it.