addLog method
Implementation
Future<void> addLog(ApiLogModel log) async {
if (!_enabled) return;
// Persist to database
await ApiDatabaseService().insertLog(log);
// If it belongs to current session, update memory list and stream
if (log.sessionId == _currentSessionId) {
_currentSessionLogs.insert(0, log);
if (_currentSessionLogs.length > 200) {
_currentSessionLogs.removeLast();
}
_logController.add(List.from(_currentSessionLogs));
}
}