---
title: audit
description: >-
  Append `entry` to the audit log. Pass the change itself as `changes`,
  statements prepared on the same `SVARTZ_DB` binding: they and the entry run as
  one transaction, so neither lands without the other. For a change kept
  elsewhere, call this first and make the change only once it resolves. Throws
  when the site binds no `SVARTZ_DB`, or the write fails.
updated_at: '2026-11-19T12:10:41+01:00'
created_at: '2026-11-19T06:37:33+01:00'
symbol:
  kind: function
  name: audit
  signatures:
    - >-
      audit(env: Readonly<Record<string, unknown>>, entry:
      [[reference/api/auth/server/AuditEntry|AuditEntry]], changes?: readonly
      Statement[]): Promise<void>
  parameters:
    - name: env
      type: 'Readonly<Record<string, unknown>>'
    - name: entry
      type: '[[reference/api/auth/server/AuditEntry|AuditEntry]]'
    - name: changes
      type: 'readonly Statement[]'
      optional: true
  returns:
    type: Promise<void>
  source: >-
    https://github.com/mia-cx/svartz/blob/711f3906a713c8b9a5a572d0f34c85e90c3bc3d1/packages/auth/src/audit.ts#L43
---

# audit
