class LogAuditStorage
implements IAuditStorage

Logs audit records through an ILogger. When constructed without a logger and used as a storage backend, queries return empty arrays.

At register time (LogAuditStorage construction with storage: 'log'), if no logger is available, throw the documented error.

Constructors

LogAuditStorage(options?: { logger?: ILogger; level?: LogLevel; })
Parameters
optional
options: { logger?: ILogger; level?: LogLevel; }

Methods

append(entry: StoredAuditEntry): Promise<void>

Routes the frozen record to logger[level]('audit', record).

close(): Promise<void>

The logger owns its own flush lifecycle; nothing to drain here.

Since 0.6.0
isHealthy(): Promise<boolean>

Lifecycle truth: the sink is the resolved ILogger, which is in-process, so reachability IS readiness. Where that logger's own transport goes is the logger's health to report, not this backend's.

isReady(): boolean

Ready as long as a logger is configured.

query(_criteria?: AuditQuery): Promise<StoredAuditEntry[]>

The log sink is the durable trail; read-back happens through the logging backend, not this object. Returns [].

setContextLogger(logger: ILogger): void

Initializes the logger from context when not injected.

setLogLevel(level: LogLevel): void

Sets the log level for emitting audit records.

Usage

import { LogAuditStorage } from "audit-plugin/src/index.ts";