logException method

void logException(
  1. dynamic error, [
  2. StackTrace? stackTrace
])

Implementation

void logException(dynamic error, [StackTrace? stackTrace]) {
  final entry = ExceptionLogEntry(error, stackTrace, DateTime.now());
  if (_logs.length >= maxLogs) {
    _logs.removeAt(0);
  }
  _logs.add(entry);
  _notifyListeners();

  // Also print to console for standard debugging
  debugPrint('🔴 Exception captured by DevTools: $error');
  if (stackTrace != null) {
    debugPrintStack(stackTrace: stackTrace);
  }
}