birch/formatter

Log formatting utilities.

Formatters transform LogRecords into strings for output.

Types

A formatter is a function that converts a LogRecord to a string.

pub type Formatter =
  fn(record.LogRecord) -> String

Values

pub fn format_metadata(
  metadata: List(#(String, String)),
) -> String

Format metadata as key=value pairs separated by spaces.

pub fn human_readable(record: record.LogRecord) -> String

Format a log record in a human-readable format.

Output format:

2024-12-26T10:30:45.123Z | INFO  | myapp.http | Request complete | key=value
pub fn simple(record: record.LogRecord) -> String

Format a log record as a simple message with level prefix.

Output format:

[INFO] Request complete
Search Document