LogShieldConfig class
Configuration for the LogShield module.
Controls log output behavior including release mode suppression, redaction notices, and custom output handlers.
final config = LogShieldConfig(
silentInRelease: true,
showRedactionNotice: true,
outputHandler: (message, level) => myLogger.log(message),
);
Constructors
-
LogShieldConfig({bool sanitizeInDebug = true, bool silentInRelease = true, bool silentInProfile = false, bool showRedactionNotice = false, void outputHandler(String sanitizedMessage, String level)?, bool showTimestamp = false, Set<
String> enabledLevels = const {}}) -
Creates a LogShieldConfig with the specified options.
const
Properties
-
enabledLevels
→ Set<
String> -
Set of log levels to output. Empty set means all levels are enabled.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- outputHandler → void Function(String sanitizedMessage, String level)?
-
Optional callback to route sanitized logs to a custom logger.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sanitizeInDebug → bool
-
Whether to sanitize (hide PII) in debug mode.
final
- showRedactionNotice → bool
-
If true, appends a redaction notice showing how many items were redacted.
final
- showTimestamp → bool
-
Whether to prepend a timestamp to each log line.
final
- silentInProfile → bool
-
If true, suppress all log output in profile mode.
final
- silentInRelease → bool
-
If true, suppress all log output in release mode.
final
Methods
-
isLevelEnabled(
String level) → bool -
Returns whether the given
levelis enabled. -
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