Home > @opengovsg/logging > Logger > withContext
Logger.withContext() method
Return a **new** logger with context merged into the existing one, leaving the original logger unchanged.
Signature:
typescript
withContext(options: {
context: LogInput['context'];
}): Logger;Parameters
| Parameter | Type | Description |
|---|---|---|
| options | { context: LogInput['context']; } | context: contextual metadata to merge. |
Returns:
A new Logger with the merged context.