Skip to content

Home > @opengovsg/logging > LoggerOptions

LoggerOptions interface ​

Per-request metadata for a request-scoped Logger. Extends SystemLoggerOptions with the request identity every request line should carry. clientIp and userAgent are **required keys** that accept string | null | undefined: the caller must *acknowledge* them — forgetting the key is a compile error — and pass null/undefined explicitly when the value is genuinely absent (e.g. a missing headers.get(...)), rather than leaving it off by accident. traceId is optional: trace correlation comes from dd-trace log injection (see SystemLoggerOptions.traceId). For request-less contexts use SystemLoggerOptions via createLogging(...).system(...), where the client identity does not exist.

Signature:

typescript
export interface LoggerOptions extends SystemLoggerOptions

Extends: SystemLoggerOptions

Properties ​

PropertyModifiersTypeDescription
clientIpstring | null | undefinedThe originating client IP (vendor-neutral; not edge-specific). Bound as client_ip. Required key — pass null/undefined if the header is absent.
userAgentstring | null | undefinedThe client User-Agent. Bound as user_agent. Required key — pass null/undefined if the header is absent.