#[repr(u8)]pub enum Severity {
Trace = 0,
Debug = 1,
Info = 2,
Warn = 3,
Error = 4,
Fatal = 5,
}Expand description
REP-2012 severity levels: rcutils’s five, in rcutils’s order, plus Trace.
NOT rcutils_log_severity_t’s numbering (UNSET=0, DEBUG=10 ... FATAL=50),
and no Unset variant. The integer representation is stable and part of the
ABI for nros_platform_log_write, so every value must be a level a sink can
render; “no level of its own” is the verb Logger::unset_level instead.
(The C surface’s rcl_log_severity_t does carry rcutils’s numbers and
UNSET.) Lower value = more verbose.
Variants§
Trace = 0
Per-instruction granularity. Off unless max-level-trace is
the active ceiling.
Debug = 1
Diagnostic information useful while developing.
Info = 2
Normal operation events worth surfacing once.
Warn = 3
Unexpected but recoverable conditions.
Error = 4
Errors the caller should surface; the system continues.
Fatal = 5
Unrecoverable — the system is about to abort.
Implementations§
Source§impl Severity
impl Severity
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Short uppercase label suitable for log-line rendering.
Sourcepub const fn rcutils_level(self) -> u8
pub const fn rcutils_level(self) -> u8
This severity on rcutils’s number line — the one every ROS 2 artefact outside this crate uses.
as_u8 is this crate’s own compact discriminant (0..=5,
chosen so a level comparison is an integer compare). It is NOT what a
rcl_interfaces/msg/Log carries, nor what <rclc/log.h>’s
rcl_log_severity_t crosses the FFI as, nor what
rcutils_logging_set_logger_level takes. Those are all rcutils’s
DEBUG=10 / INFO=20 / WARN=30 / ERROR=40 / FATAL=50.
THE ONE SPELLING of that mapping (issue 1025’s class: one number, two
derivations, agreeing until the day they do not). nros-c’s
rcl_log_severity_t::from_facade is built on this, and a test there
pins the result against the values <rclc/log.h> declares — which is
the strongest join available, since this crate cannot see that header.
Trace takes 5, a value inside rcutils’s own UNSET..DEBUG gap:
rcutils has no TRACE, and borrowing DEBUG’s number would make the two
levels indistinguishable on the wire.