MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / level_label

Function level_label

atomic-cli/src/logging/terminal.rs:46–57  ·  view source on GitHub ↗

The level padded to five columns, in `env_logger`'s colors.

(level: &Level)

Source from the content-addressed store, hash-verified

44
45/// The level padded to five columns, in `env_logger`'s colors.
46fn level_label(level: &Level) -> console::StyledObject<String> {
47 let style = match *level {
48 Level::ERROR => console::Style::new().red(),
49 Level::WARN => console::Style::new().yellow(),
50 Level::INFO => console::Style::new().green(),
51 Level::DEBUG => console::Style::new().blue(),
52 Level::TRACE => console::Style::new().cyan(),
53 };
54 style
55 .for_stderr()
56 .apply_to(format!("{:<5}", level.as_str()))
57}
58
59#[cfg(test)]
60mod tests {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected