copyWith method
Returns a copy of this LogOptions with the given fields replaced.
Used by beforeSend to transform an event before it is enqueued.
Los campos nullables (stackTrace, metadata, userIdentifier,
sessionId, clientTimestamp) usan un centinela interno: omitir el
parámetro conserva el valor actual, mientras que pasar null
explícitamente lo borra. Por ejemplo, copyWith(userIdentifier: null)
quita el userIdentifier para redactar PII antes de enviar el evento.
Implementation
LogOptions copyWith({
LogLevel? level,
String? message,
Object? stackTrace = _unset,
Object? metadata = _unset,
Object? userIdentifier = _unset,
Object? sessionId = _unset,
bool? autoCaptured,
Object? clientTimestamp = _unset,
}) {
return LogOptions(
level: level ?? this.level,
message: message ?? this.message,
stackTrace:
identical(stackTrace, _unset) ? this.stackTrace : stackTrace as String?,
metadata: identical(metadata, _unset) ? this.metadata : metadata as String?,
userIdentifier: identical(userIdentifier, _unset)
? this.userIdentifier
: userIdentifier as String?,
sessionId:
identical(sessionId, _unset) ? this.sessionId : sessionId as String?,
autoCaptured: autoCaptured ?? this.autoCaptured,
clientTimestamp: identical(clientTimestamp, _unset)
? this.clientTimestamp
: clientTimestamp as String?,
);
}