PrettyConsoleTransport class
A human-friendly console transport with emoji indicators, aligned level labels, and optional multi-line formatting for errors and stack traces.
Example output:
đ DEBUG 12:34:56.789 [MyApp] Hello world
âšī¸ INFO 12:34:56.790 [MyApp] Server started
â ī¸ WARN 12:34:56.791 [MyApp] Disk usage high
đĨ ERROR 12:34:56.792 [MyApp] Unhandled exception
âŗ Exception: something went wrong
âŗ #0 main (file:///...:10:5)
config keys:
colorize(bool): wrap output in ANSI colors (defaulttrue).showTimestamp(bool): include HH:mm:ss.SSS timestamp (defaulttrue).showContext(bool): include the context label (defaulttrue).showStackTrace(bool): print stack traces when present (defaulttrue).
- Inheritance
- Available extensions
Constructors
-
PrettyConsoleTransport({LogLevel level = LogLevel.info, Map<
String, dynamic> config = const {}}) - Creates a PrettyConsoleTransport.
Properties
- colorize â bool
-
Whether to wrap output in ANSI colors. Defaults to
true.final -
config
â Map<
String, dynamic> -
Arbitrary key/value options passed to the transport at construction time.
finalinherited
- hashCode â int
-
The hash code for this object.
no setterinherited
- level â LogLevel
-
Minimum severity level this transport will handle.
finalinherited
- runtimeType â Type
-
A representation of the runtime type of the object.
no setterinherited
- showContext â bool
-
Whether to include the context label. Defaults to
true.final - showStackTrace â bool
-
Whether to print stack traces when present. Defaults to
true.final - showTimestamp â bool
-
Whether to include an
HH:mm:ss.SSStimestamp prefix. Defaults totrue.final
Methods
-
emitLog(
LogEvent event) â Future< void> -
Performs the actual delivery of
eventto the transport's destination.override -
log(
LogEvent event) â Future< void> -
Delivers
eventto the destination ifevent.level >= this.level.inherited -
noSuchMethod(
Invocation invocation) â dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) â String -
A string representation of this object.
inherited
-
withBuffer(
{int maxSize = 100, Duration? flushInterval}) â BufferedTransport -
Available on Transport, provided by the BufferedTransportExtension extension
Wraps this transport in a BufferedTransport. -
withSampling(
{required double sampleRate, List< LogLevel> levels = const [], Random? random}) â SamplingTransport -
Available on Transport, provided by the SamplingTransportExtension extension
Wraps this transport in a SamplingTransport.
Operators
-
operator ==(
Object other) â bool -
The equality operator.
inherited