ConsoleHandler class

A pre-wired Handler that outputs styled log records to stdout/console.

By default, it uses StructuredFormatter, StyleDecorator with LogTheme.dark(), and a ConsoleSink.

To offload formatting, decoration, and console output to a background isolate, use the ConsoleHandler.async constructor.

Inheritance
Annotations
  • @immutable

Constructors

ConsoleHandler({LogTheme? theme, int? lineLength, LogFormatter? formatter, List<LogDecorator>? decorators, List<LogFilter> filters = const [], LogEngine engine = const StandardEngine(), Duration? timeout})
Creates a synchronous ConsoleHandler.

Properties

decorators List<LogDecorator>
A list of LogDecorators applied sequentially to the intermediate LogDocument.
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 LogFormatter used to transform an incoming LogEntry into a semantic LogDocument (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({LogTheme? theme, int? lineLength, LogFormatter? formatter, List<LogDecorator>? decorators, List<LogFilter> filters = const [], LogEngine engine = const StandardEngine(), Duration? timeout}) AsyncHandler
Creates an asynchronous ConsoleHandler offloaded to a background isolate.