Skip to content

AccessLogOptions

Defined in: src/access-log.ts:337

Options for AccessLogHook.

level matches Python’s logger-level gating in _emit_access_log: at “INFO” the heavy request_data field (a base64 of the full request batch — typically 8+ KiB per init RPC) is replaced with a truncated: "payload_omitted" marker plus original_request_bytes, so the access-log schema’s “unary requires request_data unless truncated” invariant still holds. Bump to “DEBUG” to capture full payloads for replay/audit.

optional async?: boolean;

Defined in: src/access-log.ts:359

Drain records through a bounded queue instead of writing inline. Opt-in: it trades the guarantee that a record on disk means the call completed. Default: false.


optional level?: "INFO" | "DEBUG";

Defined in: src/access-log.ts:341

Verbosity for heavy fields. Default: “INFO”.


optional maxRecordBytes?: number;

Defined in: src/access-log.ts:348

Per-record byte cap. Records above it shed fields in the order the spec mandates (request_data, then claims, then a sentinel form) so log shippers with a per-line ceiling do not drop the line outright. Default: 1 MiB. Pass 0 to disable.


optional queueSize?: number;

Defined in: src/access-log.ts:361

Queue depth when async is set. Default: 10000.


optional redactor?: ClaimRedactor;

Defined in: src/access-log.ts:368

Claim-redaction policy. Defaults to redactClaims; pass noRedaction for a service that owns its logs end to end.


optional sampleRate?: number;

Defined in: src/access-log.ts:355

Fraction of successful calls to log, 0.0–1.0. Default 1.0 (log everything). Errors are always logged. See AccessLogSampler.

RangeError at construction when out of range.


optional serverVersion?: string;

Defined in: src/access-log.ts:339

Server version string (optional).


optional traceContext?: TraceContextResolver;

Defined in: src/access-log.ts:365

Trace-context source. Defaults to otelTraceContext, which reads the active OpenTelemetry span when @opentelemetry/api is installed and is a no-op otherwise. Pass () => null to disable.