flush method

Future<void> flush()

Flush buffered entries to the server immediately.

Implementation

Future<void> flush() async {
  _flushTimer?.cancel();
  _flushTimer = null;
  if (_buffer.isEmpty) return;

  final entries = List<LogEntry>.from(_buffer);
  _buffer.clear();

  if (!_authenticated) {
    if (!_connecting) _doConnect();
    _buffer.addAll(entries);
    return;
  }

  _sendBatch(entries);
}