Skip to main content

@rbxts/rlog > RLog > withConfig

RLog.withConfig() method

Returns a new RLog with the provided config merged with the existing config.

Signature:

withConfig(config: PartialRLogConfig): RLog;

Parameters

Parameter

Type

Description

config

PartialRLogConfig

Configuration settings to apply to the new instance.

Returns:

RLog

The new RLog instance

Example

let logger = new RLog({ minLogLevel: LogLevel.DEBUG });

const data = { position: new Vector2(5, 10) };

logger.v("Hello verbose!", data);
logger.d("Hello debug!", data);
// > [DEBUG]: Hello debug!
// > { data: { position: { X: 5, Y: 10 } } }

// Inherits the minLogLevel
logger = logger.withConfig({ serialization: { encodeRobloxTypes: false } });

logger.v("Hello verbose!", data);
logger.d("Hello debug!", data);
// > [DEBUG]: Hello debug!
// > { data: { position: "<Vector2>" } }