append method

void append(
  1. ToolEvent event
)

Implementation

void append(ToolEvent event) {
  try {
    final file = io.File(path);
    if (!file.parent.existsSync()) file.parent.createSync(recursive: true);
    file.writeAsStringSync('${jsonEncode(event.toRow())}\n', mode: io.FileMode.append, flush: true);
    lastId = event.id;
    _maybeRotate(file);
  } on Object {
    // Persistence is best-effort; the in-memory ring still has the event.
  }
}