ISpectTraceConfig class
Base configuration for trace operations.
Subclasses (e.g. ISpectDbConfig) must override copyWith to preserve
their additional fields.
Example:
// Log all errors, sample 10% of successes, redact sensitive keys,
// and mark operations slower than 500ms as "slow".
const cfg = ISpectTraceConfig(
sampleRate: 0.1,
errorSampleRate: 1.0,
redact: true,
slowThreshold: Duration(milliseconds: 500),
attachStackOnError: true,
);
await logger.authTrace(
operation: 'login',
config: cfg,
() => authService.signIn(email, password),
);
- Annotations
-
- @immutable
Constructors
Properties
- attachStackOnError → bool
-
Whether to attach stack traces on error.
final
- errorSampleRate → double
-
Sampling rate for error operations (default: 1.0 = log all errors).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxValueLength → int
-
Maximum length for string values before truncation.
final
- redact → bool
-
Whether to auto-redact sensitive data.
final
-
redactKeys
→ Set<
String> -
Keys to redact in meta maps and URL query params.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampleRate → double?
-
Sampling rate for successful operations.
final
- slowThreshold → Duration?
-
Duration threshold for "slow" operations.
final
Methods
-
copyWith(
{double? sampleRate, double? errorSampleRate, bool? redact, Set< String> ? redactKeys, int? maxValueLength, bool? attachStackOnError, Duration? slowThreshold}) → ISpectTraceConfig -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shouldLog(
{required bool isError, double? localSample}) → bool - Sampling precedence: error → localSample → sampleRate → null (log all).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited