Skip to content

Home > @opengovsg/logging > SystemLoggerOptions

SystemLoggerOptions interface ​

Metadata for a **request-less** ("system") Logger — process startup, background jobs, cron, queue consumers, CLI. These contexts have no client identity, so clientIp / userAgent are absent here; bind a request logger with LoggerOptions instead when handling an HTTP request.

Signature:

typescript
export interface SystemLoggerOptions

Properties ​

PropertyModifiersTypeDescription
clientVersion?string | null(Optional) The client build version. Bound as client_version; drives is_latest_version. Accepts null (e.g. from headers.get).
correlationId?string(Optional) Cross-system request correlation ID. Bound as correlation_id.
deviceId?string(Optional) The client device identifier. Bound as device_id.
pathstringThe request path or operation entry point. Bound as the path Scope field. Required.
serverVersion?string(Optional) The server build version. Bound as server_version; drives the computed is_latest_version.
source?string | null(Optional) Where the log originated, e.g. trpc / rest. Bound as source. Accepts null (e.g. from headers.get).
traceId?string | null(Optional) Distributed-trace correlation ID, bound as trace_id. **Usually leave this unset**: with dd-trace running, log injection (DD_LOGS_INJECTION, on by default) already stamps dd.trace_id on every line from the active span - per line, so it also works in jobs, queues, and cron, and Datadog correlates on it natively. Set this only for a non-APM sink that needs a trace id under this schema's own trace_id key; for a gateway-minted ID chained across systems, use SystemLoggerOptions.correlationId instead. Accepts null (e.g. from headers.get); a null value is omitted from the line.
userId?string(Optional) The acting user's ID. Bound as user_id — the canonical user-correlation facet.