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 (default true).
  • showTimestamp (bool): include HH:mm:ss.SSS timestamp (default true).
  • showContext (bool): include the context label (default true).
  • showStackTrace (bool): print stack traces when present (default true).
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.SSS timestamp prefix. Defaults to true.
final

Methods

emitLog(LogEvent event) → Future<void>
Performs the actual delivery of event to the transport's destination.
override
log(LogEvent event) → Future<void>
Delivers event to the destination if event.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