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
- Renders the log severity level in brackets.
- BracketedTimestamp
-
Renders a timestamp in brackets: "
HH:mm:ss.mmm". - ChirpLogo
- A span that renders the Chirp ASCII art logo.
- ClassName
- Renders a class name with optional instance hash.
- DartSourceCodeLocation
- Renders a source code location as "file:line".
- DataKey
- Renders a single data key formatted for YAML output.
- DataValue
- Renders a single data value formatted for YAML output.
- EmptySpan
- A span that renders nothing.
- ErrorSpan
- Renders an error or exception object.
- InlineData
- Renders structured key-value data inline with the log message.
- LeafSpan
- Base class for spans that have no children.
- LoggerName
- Renders a logger name for named loggers.
- LogMessage
- Renders the primary log message.
- LogSpan
- Base class for all log spans - a mutable tree structure.
- MethodName
- Renders the method name where the log call originated.
- MultiChildSpan
- Base class for spans that have multiple ordered children.
- MultilineData
- Renders structured key-value data in multi-line YAML format.
- NewLine
-
Renders a line break (
\n). - PlainText
- Renders literal text without any ANSI formatting.
- 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
- Renders a stack trace.
- Surrounded
- Renders a prefix and/or suffix around an optional child.
- Timestamp
- Renders a timestamp in "HH:mm:ss.mmm" format (time only, no date).
- Whitespace
- Renders a single space character.
Enums
- BoxBorderStyle
- Border style for box spans.
- ColorSaturation
- Color palette intensity for hash-based color selection, see colorForHash
- HorizontalAlign
- Horizontal alignment options for Aligned spans.
Functions
-
colorForHash(
Object? object, {ColorSaturation? saturation, TerminalColorSupport? colorSupport}) → ConsoleColor -
Selects a readable color for
objectbased on terminal capabilities. -
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.