logStateChange static method

Future<void> logStateChange({
  1. required String stateKey,
  2. required dynamic oldValue,
  3. required dynamic newValue,
  4. String? userId,
  5. String? userEmail,
  6. Map<String, dynamic>? metadata,
})

Log state change

Implementation

static Future<void> logStateChange({
  required String stateKey,
  required dynamic oldValue,
  required dynamic newValue,
  String? userId,
  String? userEmail,
  Map<String, dynamic>? metadata,
}) async {
  if (!_config.enabled) return;

  final event = AuditEvent(
    type: AuditEventType.stateChange,
    stateKey: stateKey,
    oldValue: oldValue,
    newValue: newValue,
    userId: userId,
    userEmail: userEmail,
    metadata: metadata,
  );

  await _logEvent(event);
}