captureLog static method
void
captureLog({
- required String message,
- required LogType type,
- Object? data,
- StackTrace? stackTrace,
Capture a log entry
Implementation
static void captureLog({
required String message,
required LogType type,
Object? data,
StackTrace? stackTrace,
}) {
if (!_enabled) return;
final entry = InterceptedLogEntry(
id: DateTime.now().millisecondsSinceEpoch.toString(),
message: message,
timestamp: DateTime.now(),
type: type,
data: data,
stackTrace: stackTrace,
);
final currentLogs = List<InterceptedLogEntry>.from(_logs.value);
currentLogs.add(entry);
_trimLogsList(currentLogs);
// Defer update to avoid setState during build phase
Future.microtask(() {
_logs.value = currentLogs;
});
}