PrettyStructuredPrinter class final

A structured and visually aligned log printer designed for clear readability.

This printer uses iconography, spacing, and formatting to make logs easy to scan, especially when scanning for fields like level, message, timestamp, and call stack.

Example Output:

┌──────────────────────────────────────────────────────────────────────────────
│ 📝 LEVEL     : INFO
│ 📅 TIMESTAMP : 2025-06-23 10:25:17.123
│ 🧩 MODULE    : AuthService
│ 🔍 MESSAGE   : Login succeeded
│ 📁 CALL STACK:
│    • #0 AuthService.login (auth_service.dart:42)
│    • #1 ...
└──────────────────────────────────────────────────────────────────────────────

Controlled by LogConfig and LogStep ordering.

Inheritance

Constructors

PrettyStructuredPrinter({int lineLength = 120, LogConfig? config, List<String>? excludePaths})
A structured and visually aligned log printer designed for clear readability.

Properties

config LogConfig
Configuration controlling visibility and format.
final
excludePaths List<String>
Exclude paths from the stack trace.
final
hashCode int
The hash code for this object.
no setterinherited
labelWidth int
final
lineLength int
Total character width for the border line.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

extractStack(StackTrace? stackTrace, List<String> excludePaths) List<String>
Extracts the stack trace from a LogRecord.
inherited
getStepValue(LogStep step, LogRecord record) String?
Extracts the string representation of the given LogStep from a LogRecord.
override
label(String text) String
levelColor(LogLevel level) AnsiColor
Returns the color for the given log level.
inherited
log(LogRecord record) List<String>
Formats the given LogRecord into a list of strings.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stringify(dynamic message) String
Converts a message to its string representation.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited