Logging
This guide explains how to control Rsbuild log output, customize the logger for a specific instance, and access the logger in different scenarios.
Rsbuild's logger is based on
rslog. See rslog for more methods and options.
Log levels
Node.js side
logLevel controls the log level of the current Rsbuild instance on the Node.js side, such as build logs in the terminal, dev server logs, and plugin logs.
For example, when logLevel is set to warn, Rsbuild only outputs warning and error logs:
Browser side
dev.client.logLevel controls the client log level shown in the browser console.
By default, dev.client.logLevel inherits the root logLevel.
Custom logger
Each Rsbuild instance creates its own logger when it is initialized. You can create a custom logger instance with createLogger and attach it to the current Rsbuild instance through customLogger.
For example, the following config makes the current instance output only warn and error logs:
Custom prefix
You can use prefix to add a fixed prefix to each log message:
Override log methods
You can use override() to replace some logger methods with a custom output format:
Instance logger
You can access the logger on an Rsbuild instance in the following ways:
- rsbuild.logger: Access the logger of the current instance in the JavaScript API.
- api.logger: Access the logger of the current instance inside a plugin.
Global logger
Rsbuild also provides a shared global logger singleton, available through logger.
- If the log level of the global logger is changed, Rsbuild instances created afterward inherit the updated log level.
Logger methods
All logger instances provide the same methods:
Debug mode
When debug mode is enabled, Rsbuild automatically raises the log level to verbose to output more detailed logs for troubleshooting.

