feat(core): Add dev.client.logLevel option#6712
feat(core): Add dev.client.logLevel option#6712chenjiahan merged 9 commits intoweb-infra-dev:mainfrom
dev.client.logLevel option#6712Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR adds a dev.client.logLevel configuration option to control the verbosity of Rsbuild's client-side browser console logs, similar to webpack-dev-server's logging setting. The feature allows developers to filter log messages from Rsbuild's development client at different levels: 'info', 'warn', 'error', or 'silent'.
Key Changes
- Added a new
logLeveloption to thedev.clientconfiguration that inherits from the rootlogLevelwhen not explicitly set - Implemented a configurable logger system for client-side code with proper log level filtering
- Updated all client-side console calls to use the new logger with the
[rsbuild]prefix
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
website/docs/en/config/dev/client.mdx |
Added documentation for the new dev.client.logLevel option with usage examples |
packages/core/src/types/config.ts |
Added logLevel property to ClientConfig type definition |
packages/core/src/defaultConfig.ts |
Added default value logic for dev.client.logLevel that inherits from root logLevel |
packages/core/src/client/log.ts |
New logger implementation with level-based filtering and message prefixing |
packages/core/src/client/hmr.ts |
Replaced direct console calls with the new logger instance |
packages/core/src/client/overlay.ts |
Replaced direct console calls with the new logger instance |
packages/core/src/server/assets-middleware/index.ts |
Updated client initialization to pass logLevel configuration |
packages/core/tests/default.test.ts |
Added comprehensive unit tests for logLevel inheritance and explicit configuration |
packages/core/tests/__snapshots__/environments.test.ts.snap |
Updated snapshots to include the new logLevel field |
e2e/cases/hmr/log-level/ |
New E2E test suite validating log level behavior in the browser |
e2e/cases/swc-plugin/index.test.ts |
Updated to set logLevel to 'silent' to avoid SWC plugin console stripping issues |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dev.logLevel optiondev.client.logLevel option
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@chenjiahan I've simplified the logger implementation, but we still need to translate the documentation |
Sure! I will add Chinese documentation after merging the PR |

Summary
Adds an option to control the verbosity of development server browser console logs, similar to the
webpack-dev-serverloggingsetting.dev.client.logLevel. I believe that machine-translated documentation won't be as clear as that written by a native speaker. Thanks!Related Links
https://webpack.js.org/configuration/dev-server/#logging
Checklist