ConsoleLogPrinter class final

The main console publisher: prints logs using a data-driven row layout.

Pass rows: [LogRow(children: [...], tail: [...])] where each child is a LogBlock element (LogNum, LogLevelName, LogTime, LogPath, LogTraceId, LogMessage, LogTags, ...).

Active vs. inactive styling: pass inactiveTheme plus filters (activeLevels/activeMinLevel, activeNamespaces — prefix matching by pathSeparator, activeTraceGroups, activeTags or isLogActive, combined with OR) to dim background logs while emphasizing matching ones. Supplying any active filter without inactiveTheme throws ArgumentError. output defaults to print and is injectable.

Note: a \n inside a message is escaped by the theme's value formatter; multi-line output comes from data, wrapping and stack traces, not from raw newlines.

Implemented types

Constructors

ConsoleLogPrinter({LogMainTheme? theme, LogMainTheme? inactiveTheme, int? activeMinLevel, Set<int>? activeLevels, Set<String>? activeNamespaces, Set<String>? activeTraceGroups, Set<String>? activeTags, bool isLogActive(Log log)?, String pathSeparator = '/', List<LogRow> rows = defaultRows, void output(String) = print, bool oneCallPerLog = false})

Properties

activeLevels Set<int>
final
activeNamespaces Set<String>
final
activeTags Set<String>
final
activeTraceGroups Set<String>
final
hashCode int
The hash code for this object.
no setterinherited
inactiveTheme LogMainTheme?
final
isLogActive bool Function(Log log)?
final
oneCallPerLog bool
Deliver a log in one output call instead of one call per line.
final
output ↔ void Function(String)
The sink every rendered line goes to; defaults to print.
getter/setter pair
pathSeparator String
Namespace path separator for prefix matching of activeNamespaces (see Logger.pathSeparator).
final
rows List<LogRow>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
theme LogMainTheme
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printRow(Log log, LogRow row, bool isActive, LogMainTheme main) → void
publish(Log log) → void
Publishes the given log event.
override
toString() String
A string representation of this object.
inherited

Operators

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

Constants

defaultRows → const List<LogRow>
The layout used when rows is not given: one row 120 columns wide, carrying the sequence number, the short level name, the time, the namespace path, the trace ids and the message, with the tags in a right-aligned LogRow.tail.