New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve logs in Vite dev server #1927
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
@@ -101,6 +103,7 @@ export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) { | |||
injectLogReplacer('log'); | |||
injectLogReplacer('error'); | |||
injectLogReplacer('warn', warningDebouncer); | |||
injectLogReplacer('debug', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just essentially makes all console.debug()
messages not show up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It adds a hook to console.debug
. Then, if it matches any of our replacers, it modifies the message or suppresses it. The false
is just to avoid the debouncing logic.
[ | ||
// Log that gets entangled with our initial dev logs | ||
([first]) => | ||
typeof first === 'string' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we want to keep the logs clean, but does it ever concern you just how much we monkey console.log and family?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see this other PR: #1928
This makes me much more comfortable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, precisely :)
WHY are these changes introduced?
Logs in Vite dev server are quite chaotic at the moment.
WHAT is this pull request doing?
HOW to test your changes?
It's easier to review this PR looking at each commit individually.
To test: run the development server in skeleton and Vite projects.