toExportMessageText method
String
toExportMessageText({
- Set<
String> ? redactKeys, - RedactionService? redactionService,
- bool enableRedaction = true,
- int? maxOutputBytes,
Message-oriented text for clipboard and other outbound UI actions.
Includes the message, error, exception, and stack trace in the same order as ISpectLogData.textMessage, while retaining typed binary provenance until the redaction pass.
Implementation
String toExportMessageText({
Set<String>? redactKeys,
RedactionService? redactionService,
bool enableRedaction = true,
int? maxOutputBytes,
}) {
final captured = captureISpectLogWithoutPayload(this);
final resourceLimits = captured.resourceLimits;
final outputBudget = _effectiveRecordBudget(maxOutputBytes, resourceLimits);
final preparedValueBytes = _preparedValueBudget(
outputBudget,
resourceLimits,
);
String? safePart(Object? value) => value == null
? null
: _redactExportText(
value,
redactKeys,
redactionService: redactionService,
enableRedaction: enableRedaction,
maxBytes: preparedValueBytes,
resourceLimits: resourceLimits,
);
final safeStack = captured.stackTraceText != null &&
!identical(captured.stackTrace, StackTrace.empty)
? 'StackTrace: ${safePart(captured.stackTraceText)}'
: null;
return _boundOutput(
joinLogParts([
safePart(captured.message),
safePart(captured.errorText),
safePart(captured.exceptionText),
safeStack,
]),
outputBudget,
);
}