ToonFileHandler class
A pre-wired Handler that outputs TOON formatted log entries to a file.
TOON is a compact, token-efficient format designed for feeding logs into
machine parsers or LLMs. Uses ToonFormatter, ToonEncoder,
and FileSink.
To offload formatting, TOON encoding, and file I/O to a background isolate, use the ToonFileHandler.async constructor.
- Annotations
-
- @immutable
Constructors
-
ToonFileHandler({required String path, String delimiter = '\t', String arrayName = 'logs', bool explicitSchema = false, ToonDialect dialect = ToonDialect.compact, FileRotation? fileRotation, int? lineLength, LogFormatter? formatter, List<
LogDecorator> ? decorators, List<LogFilter> filters = const [], LogEngine engine = const StandardEngine(), Duration? timeout}) - Creates a synchronous ToonFileHandler.
Properties
-
decorators
→ List<
LogDecorator> -
A list of
LogDecorators applied sequentially to the intermediateLogDocument.finalinherited - engine → LogEngine
-
The execution strategy and scheduling model for the log pipeline.
finalinherited
-
filters
→ List<
LogFilter> -
A list of
LogFilters evaluated sequentially before formatting or decorating.finalinherited - formatter → LogFormatter
-
The
LogFormatterused to transform an incomingLogEntryinto a semanticLogDocument(Semantic IR).finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sink → LogSink
-
The target destination where formatted and decorated log output is
written.
finalinherited
- timeout → Duration?
-
The maximum duration permitted for processing a single log entry.
finalinherited
Methods
-
dispose(
) → Future< void> -
Disposes of any resources held by this handler.
inherited
-
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
Static Methods
-
async(
{required String path, String delimiter = '\t', String arrayName = 'logs', bool explicitSchema = false, ToonDialect dialect = ToonDialect.compact, FileRotation? fileRotation, int? lineLength, LogFormatter? formatter, List< LogDecorator> ? decorators, List<LogFilter> filters = const [], LogEngine engine = const StandardEngine(), Duration? timeout}) → AsyncHandler - Creates an asynchronous ToonFileHandler offloaded to a background isolate.