@frozen public struct EventConfiguration : Sendable
Configuration parameters for Realm event recording.
Enabling Realm event recording is done by setting
Realm.Configuration.eventConfiguration to any non-nil
EventConfiguration. A default-initialized configuration is valid, but
some properties may need to be customized.
Using Realm event recording requires including the collection
in your schema defined on the server for the App which you will be writing
events to. The schema must contain the following fields:
DateIn addition, there must be a
String?field for each metadata key used.
Metadata which is attached to each event generated. Each key in the metadata dictionary is stored in a column with that name in the event Realm, and so the schema configured on the server for the AuditEvent collection must include all metadata fields which will be used. The metadata fields must be of type
String?in the server-side schema.
public var metadata: [String : String]?
The user must be associated with a partition-based sync app. If the traced Realm is using flexible sync, setting this field to a PBS user is mandatory.
public var syncUser: User?
A string prepended to the randomly-generated partition values used for uploading event data to the server. This can be customized to ensure that you can distinguish event partitions from partitions used by your application.
public var partitionPrefix: String
The error handler which will be called if a sync error occurs when uploading event data. If
nil, the error will be logged and then
abort()will be called. Production usage should always define a custom error handler unless aborting on error is desired.
@preconcurrency public var errorHandler: (@Sendable (Swift.Error) -> Void)?
EventConfigurationwhich enables Realm event recording.