Skip to content

auditLog

auditLog(options): HookFunction

Defined in: audit.ts:75

Returns a hook recording { principal, agentId?, path, method, params, resultSummary, timestamp } to options.sink on every call. Register the same returned function in after.all and error.all — it fires exactly once per call, on whichever phase actually reaches it (a successful call never reaches error.all; a thrown call never reaches after.all).

app.service("documents").hooks({
after: { all: [auditLog({ sink: auditRepository })] },
error: { all: [auditLog({ sink: auditRepository })] },
});

A sink write failure is caught and never rethrown — see AuditLogOptions.onSinkError.

AuditLogOptions

HookFunction