addEvent

open suspend override fun addEvent(event: Event): Event?

Adds a new event to the logger.

This method generates a chronologically-sortable storage identifier and a current timestamp for the event, runs application-provided onAddEvent to check if the event should be dropped or if app-specific data should be amended, and then finally saves the event.

If successful, it triggers an emission to eventFlow.

Most code logging events will want to use addEventAsync since it runs in a separate coroutine and thus not slow down a time-sensitive where an external component is waiting for data to be returned.

Return

A copy of the Event with assigned id, timestamp, and appData. Returns null if the event was dropped.

Parameters

event

The Event to be recorded.