LoggerConfig class

Configuration for the logger interceptor.

Constructors

LoggerConfig({bool enabled = true, LogLevel level = LogLevel.info, bool logRequestHeaders = true, bool logRequestBody = false, bool logResponseHeaders = false, bool logResponseBody = false, bool logErrors = true, int maxBodyLength = 1024, List<String> redactedHeaders = const ['Authorization', 'Cookie', 'Set-Cookie'], LogHandler? logHandler, bool includeTimestamp = false})
const
LoggerConfig.disabled()
Creates a disabled config.
factory
LoggerConfig.minimal()
Creates a minimal config for production.
factory
LoggerConfig.trace()
Creates a config suitable for debug/development mode.
factory

Properties

enabled → bool
Whether logging is enabled.
final
hashCode → int
The hash code for this object.
no setterinherited
includeTimestamp → bool
Whether to include timestamps in default log output.
final
level → LogLevel
Minimum log level to output.
final
logErrors → bool
Whether to log errors.
final
logHandler → LogHandler?
Custom log handler. If null, uses default print-based logging.
final
logRequestBody → bool
Whether to log request body.
final
logRequestHeaders → bool
Whether to log request headers.
final
logResponseBody → bool
Whether to log response body.
final
logResponseHeaders → bool
Whether to log response headers.
final
maxBodyLength → int
Maximum body length for the text this config renders — the default printer's output and anything you pass through truncateBody.
final
redactedHeaders → List<String>
Headers to redact from logs (e.g., Authorization).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({bool? enabled, LogLevel? level, bool? logRequestHeaders, bool? logRequestBody, bool? logResponseHeaders, bool? logResponseBody, bool? logErrors, int? maxBodyLength, List<String>? redactedHeaders, LogHandler? logHandler, bool? includeTimestamp}) → LoggerConfig
Creates a copy with updated values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redactHeaders(Map<String, dynamic> headers) → Map<String, dynamic>
Redacts sensitive headers from a headers map.
shouldLog(LogLevel logLevel) → bool
Returns true if the given level should be logged.
toString() → String
A string representation of this object.
inherited
truncateBody(dynamic body) → String
Renders body in at most maxBodyLength characters, then ... [truncated].

Operators

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