SpanBasedFormatter class abstract
Base class for formatters that use the span-based templating system.
Provides common functionality for building spans, applying transformers, and rendering to the buffer. Subclasses only need to implement buildSpan.
Example
class MyFormatter extends SpanBasedFormatter {
MyFormatter({super.spanTransformers});
@override
LogSpan buildSpan(LogRecord record) {
return SpanSequence(children: [
Timestamp(record.date),
Whitespace(),
LogMessage(record.message),
]);
}
}
- Inheritance
-
- Object
- ChirpFormatter
- SpanBasedFormatter
- Implementers
- Annotations
-
- @experimental
Constructors
-
SpanBasedFormatter({List<
SpanTransformer> ? spanTransformers}) - Creates a span-based formatter.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- recordSeparator → String
-
Separator written after each formatted record in file output.
no setterinherited
- requiresCallerInfo → bool
-
Whether this formatter needs caller info (file, line, class, method).
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
spanTransformers
→ List<
SpanTransformer> -
Transformers to apply to the span tree before rendering.
final
Methods
-
buildSpan(
LogRecord record) → LogSpan -
Builds the span tree for the given
record. -
format(
LogRecord record, MessageBuffer buffer) → void -
Formats
recordby writing tobuffer.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited