Skip to content

fix: hmrClient.logger.debug and hmrClient.logger.error looked different from other HMR logs#22147

Open
Bryasxin wants to merge 3 commits intovitejs:mainfrom
Bryasxin:main
Open

fix: hmrClient.logger.debug and hmrClient.logger.error looked different from other HMR logs#22147
Bryasxin wants to merge 3 commits intovitejs:mainfrom
Bryasxin:main

Conversation

@Bryasxin
Copy link
Copy Markdown

@Bryasxin Bryasxin commented Apr 6, 2026

fixes #22146

Copy link
Copy Markdown
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

@sheremet-va It'd be nice to have your input here since you've abstracted the logger before in #15631

The idea makes sense to me to have the logs show consistently, but does this change make sense in general for the logger? And is it normal for hmrLogger.debug to be printed out by default?

Comment thread packages/vite/src/node/ssr/runtime/serverModuleRunner.ts Outdated
@Bryasxin
Copy link
Copy Markdown
Author

Bryasxin commented Apr 7, 2026

I confirmed that hmrClient.logger.debug is printed by default when running bun vite without any extra configuration. So yes, it's currently always active.

Not sure if that's the intended behavior, should it be gated behind a lower log level?

@sheremet-va
Copy link
Copy Markdown
Member

I thought it's not even working by default for the SSR environment 🤔

@sheremet-va
Copy link
Copy Markdown
Member

And is it normal for hmrLogger.debug to be printed out by default?

The implementation just copies how it works in the browser. There it calls console.debug, but I guess it's easier to hide them DevTools. For SSR environment, I am not sure what makes more sense.

@bluwy
Copy link
Copy Markdown
Member

bluwy commented Apr 13, 2026

We have debug logging using the DEBUG env var, I think it makes sense so it works that way too if the logs are indeed for debugging and not general logs.

Anyways this is a bigger change, and if this PR looks good to you, then I think we can go with this first. Maybe we want to revisit this before the environment api goes stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[vite] program reload log is missing timestamp prefix, inconsistent with other HMR log messages

3 participants