Skip to content

Home > @opengovsg/logging > LoggingConfig

LoggingConfig interface ​

Deployment config passed to createLogging(). The core reads no environment variables of its own — the consuming app injects these.

Signature:

typescript
export interface LoggingConfig

Properties ​

PropertyModifiersTypeDescription
envstringDeployment environment, bound on every line as env. Required — no default.
level?LogLevel(Optional) Minimum level to emit. silent disables output. Optional; defaults to info.
pretty?boolean(Optional) Pretty-print to the console (dev) instead of NDJSON to stdout. Optional; defaults to false.
serializeError?(err: Error) => Record<string, unknown>(Optional) Shape a thrown error into the error wire field. Receives an already-normalised Error (any non-Error thrown value is normalised first), set once here for the whole factory. Optional; defaults to the framework-neutral serializeError(). Override to add framework-specific shaping — e.g. mapping a tRPC code to error.kind, or a NestJS HttpException status.
servicestringService name, bound on every line as service. Completes Datadog unified tagging (env + service + version). Required — no default.
versionstringApplication version, bound on every line as version. Required — no default.