sveltekit-admin does not ship an AuditLog table or a dedicated log UI. It
gives you a single opt-in hook, audit, called after every successful create, update, or delete. You decide where the event goes — your own Prisma
or Drizzle model, a logger, an HTTP sink.
If audit is omitted, nothing changes: no extra reads, no calls.
audit
The callback receives a discriminated AuditEvent:
Reads (GET), logout, and _search are not audited. A POST that fails
validation or the database write does not call audit.
Who did it?
The library has no session of its own. Put the signed-in admin on event.locals in your auth handle (see Authentication),
then read it from entry.event.locals in audit.
Redaction
Fields whose names match password / hash / secret / token, and fields
listed in models[].hidden, are stripped from values, before, after,
and changes. A submitted password on a create form never reaches your sink.
Failures
audit is awaited before the 303 redirect so a prisma.auditLog.create(...) inside it commits first. If the callback throws, the mutation still
redirects — the write is the source of truth, the log is a sidecar. The
handler logs [sveltekit-admin] audit callback failed:.
There is no single transaction wrapping the adapter write and your sink: that would require the package to own both stores.
Viewing logs in the admin
Persist to a model in your schema and it shows up in the admin like any
other table. exclude: ['AuditLog'] if you do not want it listed, or mark
its fields readonly. Writing an audit row through the admin UI would
itself fire audit — skip that in the callback: