Skip to content

feat(core): Add dev.client.logLevel option#6712

Merged
chenjiahan merged 9 commits intoweb-infra-dev:mainfrom
zalishchuk:dev-client-loglevel
Dec 5, 2025
Merged

feat(core): Add dev.client.logLevel option#6712
chenjiahan merged 9 commits intoweb-infra-dev:mainfrom
zalishchuk:dev-client-loglevel

Conversation

@zalishchuk
Copy link
Contributor

Summary

Adds an option to control the verbosity of development server browser console logs, similar to the webpack-dev-server logging setting.

⚠️ Please include Chinese documentation for 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

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 5, 2025 04:18
@netlify
Copy link

netlify bot commented Dec 5, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit afb2f74
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/69336652693cde0008d36272
😎 Deploy Preview https://deploy-preview-6712--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 73 (🟢 up 11 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 logLevel option to the dev.client configuration that inherits from the root logLevel when 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.

@zalishchuk zalishchuk changed the title feat(core): Add dev.logLevel option feat(core): Add dev.client.logLevel option Dec 5, 2025
@zalishchuk zalishchuk marked this pull request as draft December 5, 2025 04:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@zalishchuk
Copy link
Contributor Author

@chenjiahan I've simplified the logger implementation, but we still need to translate the documentation

@zalishchuk zalishchuk marked this pull request as ready for review December 5, 2025 21:04
@chenjiahan
Copy link
Member

we still need to translate the documentation

Sure! I will add Chinese documentation after merging the PR

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, awesome!

@chenjiahan chenjiahan merged commit 7f96112 into web-infra-dev:main Dec 5, 2025
11 checks passed
@chenjiahan chenjiahan mentioned this pull request Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants