@rbxts/rlog > LogContext > use
LogContext.use() method
Creates a new RLog instance that inherits this context.
Signature:
use(config?: PartialRLogConfig): RLog;
Parameters
Parameter | Type | Description |
---|---|---|
config | (Optional) Config to merge with this context and the new instance. |
Returns:
A new RLog instance.
Exceptions
If the context is dead (i.e., if stop was called already)
Remarks
All RLog instances that use the same LogContext will have the same correlation_id
attached to their messages.
Example
const context = LogContext.start();
const logger = context.use({ tag: "Main" });
logger.i("Hello world!");
context.stop();
// > [INFO]: Main -> Hello world!
// > { correlation_id: "sITjsHD89b" }