Skip to main content

resolve_logger

Function resolve_logger 

Source
pub fn resolve_logger(name: &str) -> &'static Logger
Expand description

Resolve name to a logger — the TOTAL form of get_or_create_logger, and the one spelling every node-shaped accessor uses.

phase-427 W5. Four accessors answer “which logger is this node’s?” — nros_node::executor::Node::logger, rclc_node_get_logger, nros_cpp_node_get_logger and rclc_log_get_logger. All four had the same job and, before this, three of them called get_logger, which is a LOOKUP: a node whose name nobody register_loggered resolved to DEFAULT_LOGGER. Two nodes in one image therefore emitted every record under the same name, "nros" — the sentinel W5 replaced, arrived at by a different route.

This creates instead, and falls back to DEFAULT_LOGGER only when it cannot — an empty or over-long name, or an exhausted arena — and says so at WARN when it does, because the catch-all’s threshold is SHARED and a silent alias makes set_level on the result move every other unnamed logger’s bar with it. The report is ONE per process: a C++ NROS_LOG_* call site asks node.get_logger() on every line, so a per-call report would be a flood.

Lookup comes first, so an image that pre-registered a 'static Logger under the node’s name still gets that exact reference and its threshold.