SecureLogger class

Security-aware logging wrapper that redacts sensitive data before output.

Wraps AppConfig.logger with automatic sanitization of:

  • Bearer tokens and authorization headers
  • API keys, secrets, and passwords
  • Sensitive query parameters

Usage:

SecureLogger.i('user_auth', 'Response: $responseBody');
// Automatically redacts: Bearer xyz → Bearer [REDACTED]

Inspired by SpotiFLAC-Mobile's logger.dart pattern.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Properties

redactionEnabled bool
Enable/disable redaction (disable in debug for full output).
getter/setter pair

Static Methods

d(String tag, String message) → void
Debug log with tag and redaction.
e(String tag, String message, [Object? error, StackTrace? stackTrace]) → void
Error log with tag, redaction, and optional error/stackTrace.
i(String tag, String message) → void
Info log with tag and redaction.
sanitize(String message) String
Sanitize a message by applying all redaction patterns.
w(String tag, String message) → void
Warning log with tag and redaction.

Constants

maxMessageLength → const int
Maximum message length before truncation.