Skip to content

Interface: LogContext

Standardized structured log context fields.

These are the conventional keys consumers should attach to log records via Logger.withContext (or Logger.child) for cross-cutting observability. Keeping field names consistent across services makes CloudWatch Logs Insights / Loki queries dramatically more useful.

Additional fields may be added as needed - the type allows arbitrary keys.

Indexable

ts
[key: string]: unknown

Properties

PropertyTypeDescription
correlationId?stringEnd-to-end correlation id that follows a logical operation across services.
module?stringLogical subsystem / module name (e.g. "reconciliation", "psp.stripe").
requestId?stringPer-request id, typically set by an HTTP middleware on each inbound request.
spanId?stringDistributed-tracing span id.
tenantId?stringTenant / brand identifier in multi-tenant systems.
traceId?stringDistributed-tracing trace id (e.g. OpenTelemetry).
userId?stringAuthenticated user id, when available.