add method

void add(
  1. LogRecord record
)

Keeps record, dropping the oldest when the ring is full, writes it to path, then passes it to the listeners.

Implementation

void add(LogRecord record) {
  if (_ring.length < capacity) {
    _ring.add(record);
  } else {
    _ring[_next] = record;
    _next = (_next + 1) % capacity;
  }
  final path = this.path;
  if (path != null) {
    appendFile(path, '$record\n');
  }
  for (final listener in [..._listeners]) {
    listener(record);
  }
}