spruce/severity
Erlang/OTP Logger and RFC 5424 severity formatting.
Types
Controls how a Severity is rendered: its style (label, badge, simple, or
custom), whether icons are shown, the glyph mode, and the padding width.
Construct one with label, badge, simple, or custom.
pub opaque type Formatter
Values
pub fn custom(
render: fn(Severity, spruce.Spruce) -> String,
target_width target_width: Int,
) -> Formatter
Render severities with a caller-supplied function.
pub fn icons(formatter: Formatter, enabled: Bool) -> Formatter
Enable or disable icons for formatters that support them.
pub fn mode(
formatter: Formatter,
mode: spruce.SymbolMode,
) -> Formatter
Override the glyph mode used by icon-bearing formatters. By default the rendering context’s symbol mode is used; call this to pin a specific mode regardless of the context.
pub fn render(
context: spruce.Spruce,
formatter: Formatter,
severity: Severity,
) -> String
Render a severity with the supplied formatter.
pub fn render_padded(
context: spruce.Spruce,
formatter: Formatter,
severity: Severity,
) -> String
Render a severity and pad it to the formatter’s visual target width.
pub fn target_width(formatter: Formatter) -> Int
Return the visual target width used by render_padded.
pub fn to_int(severity: Severity) -> Int
Convert a severity to its RFC 5424 ordering integer.
pub fn to_string(severity: Severity) -> String
Convert a severity to its uppercase label.
pub fn to_string_lowercase(severity: Severity) -> String
Convert a severity to its lowercase label.