flush method

Future<void> flush()

Sends all buffered events to inner and clears the buffer.

Safe to call concurrently — the buffer is snapshotted atomically before any async work begins.

Implementation

Future<void> flush() async {
  if (_buffer.isEmpty) return;
  final events = List<LogEvent>.from(_buffer);
  _buffer.clear();
  for (final event in events) {
    await inner.log(event);
  }
}