Class: AuditLogger
Defined in: src/tollgate/audit/logger.ts:73 AuditLogger records all tool calls and session grants to SQLite. Uses WAL mode for concurrent access and prepared statements for performance.Example
Constructors
Constructor
Parameters
optionsOrPath?
string | AuditLoggerOptions
Returns
AuditLogger
Methods
close()
Returns
void
getActiveSessionGrants()
Parameters
server?
string
Server name to filter by (optional)
Returns
SessionGrantRecord[]
Array of active grants
getRecentCalls()
Parameters
limitOrOptions
number | {
includeRedacted?: boolean;
limit?: number;
riskLevel?: AuditRiskLevel;
server?: string;
since?: Date;
until?: Date;
}
Returns
AuditRecord[]
getSessionStats()
Returns
activeGrants
expiredGrants
revokedGrants
totalGrants
totalUsage
getStats()
Returns
allowed
denied
prompted
sessionAuthorized
total
logAttempt()
Parameters
context
The tool call contextdecision
The policy decisionsessionGrantId?
string
ID of session grant that authorized this call (if any)
metadata?
Additional metadata for the audit recordclientId?
string
correlationId?
string
Returns
string
The generated audit record ID
logResult()
Parameters
id
string
The audit record ID from logAttempt
userDecision
The user’s approval decision (if prompted)ApprovalResult | null
result
Whether the tool call succeeded or failed"error" | "success"
errorMessage?
string
Error message (if result is ‘error’)
durationMs?
number
Total duration of the tool call
Returns
void
logSessionGrant()
Parameters
grant
The session grant to logReturns
void
logSessionGrantUsage()
Parameters
grantId
string
The session grant ID
Returns
void
revokeSessionGrant()
Parameters
grantId
string
The session grant ID
revokedBy
string
Who revoked it (e.g., ‘user’, ‘timeout’, ‘policy’)
Returns
void