@rbxts/rlog > RLog > withTag
RLog.withTag() method
Returns a new RLog with the tag set to the provided string.
Signature:
withTag(tag: string): RLog;
Parameters
Parameter | Type | Description |
---|---|---|
tag | string | The new tag to use. |
Returns:
The new RLog instance.
Remarks
Tags are appended to log messages when present, for easier filtering.
Usually, they're used at the class or module level to keep track of all logs facilitated by a single service or action.
Example
let logger = new RLog();
logger.d("Hello world!");
// > [DEBUG]: "Hello world!"
logger = logger.withTag("main");
logger.d("Hello world!");
// > [DEBUG]: main -> "Hello world!"