spruce/line

Compact single-line message composition.

A Line wraps a main message with an optional timestamp, severity, scope, and key-value details, rendered to one styled line via render. Build one with new and the combinators in this module.

Types

A composable single-line message with optional prefixes and details.

pub opaque type Line

Values

pub fn details(line: Line, details: details.Details) -> Line

Add key-value details after the main text.

pub fn new(text: String) -> Line

Start a compact line with the main message text.

pub fn render(sp: spruce.Spruce, line: Line) -> String

Render the compact line.

pub fn scope(line: Line, scope: String) -> Line

Add a dim [scope] prefix.

pub fn severity(line: Line, severity: severity.Severity) -> Line

Add a generic severity/status prefix.

pub fn severity_formatter(
  line: Line,
  formatter: severity.Formatter,
) -> Line

Override the severity formatter.

pub fn timestamp(line: Line, timestamp: String) -> Line

Add a timestamp prefix.

Search Document