Skip to main content

@rbxts/rlog > RLogConfig > contextBypass

RLogConfig.contextBypass property

Allows logs that have context to bypass minLogLevel under certain circumstances.

Signature:

readonly contextBypass: boolean;

Remarks

With this setting enabled, even if the minLogLevel is set to filter out logs below WARNING, if one of the logs in the context is that of WARNING or above, then all of the logs in the context will be sent through.

Allows you to set a high minLogLevel without sacrificing a proper log trace whenever something bad happens.

Example

const config = { minLogLevel: LogLevel.DEBUG, contextBypass: true }

withLogContext(config, (context) => {
const logger = context.use();

logger.i("Hello world!");
logger.w("Oh no!");
logger.i("Goodbye world!");
});
// > [WARNING]: Oh no!
// > { correlation_id: "QQLRSFsPfoTfgD7b" }
//
// > [INFO]: Hello world!
// > { correlation_id: "QQLRSFsPfoTfgD7b" }
//
// > [INFO]: Goodbye world!
// > { correlation_id: "QQLRSFsPfoTfgD7b" }