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:
export interface LoggerOptions extends SystemLoggerOptionsExtends: SystemLoggerOptions
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| clientIp | string | null | undefined | The originating client IP (vendor-neutral; not edge-specific). Bound as client_ip. Required key — pass null/undefined if the header is absent. | |
| userAgent | string | null | undefined | The client User-Agent. Bound as user_agent. Required key — pass null/undefined if the header is absent. |