@rbxts/rlog > LogContext > withConfig
LogContext.withConfig() method
Creates a new LogContext instance that inherits this context.
Signature:
withConfig(config: PartialRLogConfig): LogContext;
Parameters
Parameter | Type | Description |
---|---|---|
config | Config to merge with this context. |
Returns:
A new LogContext instance.
Exceptions
If the context is dead (i.e., if stop was called already)
Remarks
The correlation id will be the same, but the config will be merged with the provided config.
Can be used to create slightly different versions of the same context.
Example
const mainContext = LogContext.start({ minLogLevel: LogLevel.DEBUG });
// inherits the `minLogLevel`
const secondaryContext = mainContext.withConfig({ contextBypass: true });