api::debug::log
Logging macros and severity levels.
Macros
Section titled “Macros”| Macro | Level | Gate |
|---|---|---|
log_error! |
Error | flint-log |
log_warn! |
Warn | flint-log |
log_info! |
Info | flint-log |
log_debug! |
Debug | flint-log |
log_trace! |
Trace | flint-log |
Every level is gated on flint-log, which debug-level-1 and above turn
on. At debug-level-0 there is no logging at all, errors included. The
table used to say the first three were “Always”; they never were, and a
user turning logging down for size was losing the error path without being
told.
The gate lives in one place, [__flint_log]. It must not be written into
the macro bodies: a cfg inside macro_rules! is resolved against the
crate expanding the macro, not this one, and no application declares a
flint-log feature. log_debug! and log_trace! carried exactly that
cfg and so expanded to nothing in every application, whatever DEBUG=
was set to.
Example
Section titled “Example”log_info!("boot complete in {} ms", 42);enum Level { Error, Warn, Info, Debug, Trace,}Log severity level.
Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq
Functions
Section titled “Functions”__flint_log
Section titled “__flint_log”fn __flint_log(_level: Level, _args: core::fmt::Arguments<'_>)The kernel-provided log write function.
References: Level