ConsoleLogStrategy constructor
ConsoleLogStrategy({})
Constructs a ConsoleLogStrategy.
logLevel sets the log level at which this strategy becomes active.
supportedEvents optionally specifies which types of LogEvent this strategy should handle.
useModernFormatting enables modern console formatting with colors and emojis.
useColors enables colored output. When autoDetectColors is true (default),
this is combined with terminal capability detection.
autoDetectColors when true (default), automatically detects if the terminal
supports ANSI colors. iOS/Android consoles don't support ANSI, so colors are
disabled automatically to avoid garbage output like \^[[36m.
showTimestamp shows timestamp in logs.
showContext shows context information in logs.
Implementation
ConsoleLogStrategy({
super.logLevel = LogLevel.none,
super.supportedEvents,
bool useModernFormatting = true,
bool useColors = true,
bool autoDetectColors = true,
bool showTimestamp = true,
bool showContext = true,
}) : _useModernFormatting = useModernFormatting,
_useColors = autoDetectColors
? (useColors && TerminalCapabilities.supportsAnsiColors)
: useColors,
_showTimestamp = showTimestamp,
_showContext = showContext;