add method

void add(
  1. String stream,
  2. String line
)

Implementation

void add(String stream, String line) {
  final boundedLine = line.length > maxCharacters
      ? line.substring(line.length - maxCharacters)
      : line;
  if (boundedLine.length != line.length) _truncated = true;
  _events.add((stream: stream, line: boundedLine));
  _characters += boundedLine.length;
  while (_events.length > maxLines || _characters > maxCharacters) {
    final removed = _events.removeFirst();
    _characters -= removed.line.length;
    _truncated = true;
  }
}