logEvent method

Future<void> logEvent(
  1. LogEventDto event
)

Implementation

Future<void> logEvent(LogEventDto event) async {
  _logService.verbose(
      'Received log event from [${event.serviceName}]/[${event.serviceInstance}].');

  await _repo.transaction((context) async {
    // TODO cache instances to avoid redundant checks
    await _repo.createInstanceIfNotExists(Instance(
      id: event.serviceInstance,
      serviceName: event.serviceName,
      createTimestamp: event.timestamp,
    ));

    await _repo.create(LogEntry.fromLogEvent(event));
  });
}