chirp_spans library

Span-based formatting system for building log output.

This library provides a tree-based approach to formatting log messages, similar to how Flutter builds widget trees.

Note: This API is experimental and may change in future versions.

Classes

Aligned
Aligns child content within a fixed-width column.
AnsiStyled
Applies foreground and/or background color and text styles to a child span.
Bordered
A span that draws an ASCII box around its content.
BoxBorderChars
Characters for drawing box borders.
BracketedLogLevel
Log severity level with brackets.
ClassName
Class or instance name.
DartSourceCodeLocation
Source code location (file and line).
EmptySpan
A span that renders nothing.
ErrorSpan
Error object.
InlineData
Structured key-value data rendered inline: (key: value, key: value).
LeafSpan
Base class for spans that have no children.
LoggerName
Logger name for named loggers.
LogMessage
The primary log message.
LogSpan
Base class for all log spans - a mutable tree structure.
MethodName
Method name where the log was called.
MultiChildSpan
Base class for spans that have multiple ordered children.
MultilineData
Structured key-value data rendered as multiline YAML.
NewLine
A line break.
PlainText
Plain text span.
SingleChildSpan
Base class for spans that have exactly one child.
SlottedSpan
Base class for spans that have named child slots.
SpanBasedFormatter
Base class for formatters that use the span-based templating system.
SpanFormatOptions
Format options that include span transformers for SpanBasedFormatter.
SpanSequence
A sequence of spans rendered sequentially.
StackTraceSpan
Stack trace.
Surrounded
Renders a prefix and/or suffix around an optional child.
Timestamp
Timestamp when the log was created.
Whitespace
A single space.

Enums

BoxBorderStyle
Border style for box spans.
HorizontalAlign
Horizontal alignment options for Aligned spans.

Functions

renderSpan(LogSpan span, ConsoleMessageBuffer buffer) → void
Renders a LogSpan tree to a ConsoleMessageBuffer.

Typedefs

SpanTransformer = void Function(LogSpan span, LogRecord record)
Callback type for transforming log spans before rendering.