LogPilotConfig class

Global configuration for LogPilot.

Pass an instance to LogPilot.init to customize behavior:

LogPilot.init(
  config: LogPilotConfig(
    logLevel: LogLevel.info,
    showCaller: true,
    showDetails: false,
  ),
  child: const MyApp(),
);

For common setups, use the named factory constructors:

LogPilotConfig.debug()       // verbose, all details on
LogPilotConfig.production()  // warning+, console off, sinks only
Annotations

Constructors

LogPilotConfig({bool? enabled, LogLevel logLevel = LogLevel.verbose, OutputFormat outputFormat = OutputFormat.pretty, bool showTimestamp = true, bool showCaller = true, bool showDetails = true, bool colorize = true, int maxLineWidth = 100, int stackTraceDepth = 8, int maxPayloadSize = 10 * 1024, List<String> maskPatterns = const ['Authorization', 'password', 'token', 'secret'], AnsiColor jsonKeyColor = AnsiColor.cyan, AnsiColor jsonValueColor = AnsiColor.green, Set<String> silencedErrors = const {}, Set<String> onlyTags = const {}, List<LogSink> sinks = const [], Duration deduplicateWindow = Duration.zero, int maxHistorySize = 500, int maxBreadcrumbs = 20})
const
LogPilotConfig.debug({OutputFormat outputFormat = OutputFormat.pretty, List<String> maskPatterns = const ['Authorization', 'password', 'token', 'secret'], Set<String> silencedErrors = const {}, Set<String> onlyTags = const {}, List<LogSink> sinks = const [], Duration deduplicateWindow = Duration.zero, int maxHistorySize = 500, int maxBreadcrumbs = 20})
Full-detail debug configuration.
factory
LogPilotConfig.production({LogLevel logLevel = LogLevel.warning, OutputFormat outputFormat = OutputFormat.pretty, List<String> maskPatterns = const ['Authorization', 'password', 'token', 'secret'], Set<String> silencedErrors = const {}, Set<String> onlyTags = const {}, List<LogSink> sinks = const [], Duration deduplicateWindow = const Duration(seconds: 5), int maxHistorySize = 500, int maxBreadcrumbs = 20})
Minimal production configuration.
factory
LogPilotConfig.staging({OutputFormat outputFormat = OutputFormat.pretty, List<String> maskPatterns = const ['Authorization', 'password', 'token', 'secret'], Set<String> silencedErrors = const {}, Set<String> onlyTags = const {}, List<LogSink> sinks = const [], Duration deduplicateWindow = const Duration(seconds: 5), int maxHistorySize = 500, int maxBreadcrumbs = 20})
Balanced staging/QA configuration.
factory
LogPilotConfig.web({LogLevel logLevel = LogLevel.info, OutputFormat outputFormat = OutputFormat.plain, List<String> maskPatterns = const ['Authorization', 'password', 'token', 'secret'], Set<String> silencedErrors = const {}, Set<String> onlyTags = const {}, List<LogSink> sinks = const [], Duration deduplicateWindow = const Duration(seconds: 5), int maxHistorySize = 200, int maxBreadcrumbs = 10})
Web-optimized configuration.
factory

Properties

colorize bool
Use ANSI color codes in output. Set false for plain text.
final
deduplicateWindow Duration
Time window for collapsing duplicate log messages.
final
enabled bool
Whether console output is active. Defaults to true in debug mode.
final
hashCode int
The hash code for this object.
no setterinherited
jsonKeyColor AnsiColor
Color applied to JSON keys (e.g. "name":).
final
jsonValueColor AnsiColor
Color applied to JSON values (e.g. "Alice", 42, true).
final
logLevel LogLevel
Minimum level a log must have to be printed or dispatched.
final
maskPatterns List<String>
Header and body field names whose values should be masked with ***.
final
maxBreadcrumbs int
Maximum number of breadcrumbs retained for error context.
final
maxHistorySize int
Maximum number of log records to keep in the in-memory ring buffer.
final
maxLineWidth int
Max character width before wrapping inside log boxes.
final
maxPayloadSize int
Payloads larger than this (in bytes) are truncated.
final
onlyTags Set<String>
When non-empty, only logs whose tag is in this set are printed.
final
outputFormat OutputFormat
Controls how log output is rendered to the console.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCaller bool
Show a clickable caller location (file.dart:line:col) in each log block produced by LogPilot.info, LogPilot.error, etc.
final
showDetails bool
Show verbose detail sections in log output.
final
showTimestamp bool
Show timestamps on each log block.
final
silencedErrors Set<String>
Error substrings to suppress entirely.
final
sinks List<LogSink>
Additional output destinations for log records.
final
stackTraceDepth int
Maximum number of stack frames to display.
final

Methods

copyWith({bool? enabled, LogLevel? logLevel, OutputFormat? outputFormat, bool? showTimestamp, bool? showCaller, bool? showDetails, bool? colorize, int? maxLineWidth, int? stackTraceDepth, int? maxPayloadSize, List<String>? maskPatterns, AnsiColor? jsonKeyColor, AnsiColor? jsonValueColor, Set<String>? silencedErrors, Set<String>? onlyTags, List<LogSink>? sinks, Duration? deduplicateWindow, int? maxHistorySize, int? maxBreadcrumbs}) LogPilotConfig
isSilenced(String text) bool
Returns true if text matches any pattern in silencedErrors.
isTagAllowed(String? tag) bool
Returns true if tag passes the onlyTags filter.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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