Replies: 1 comment
|
Those browser lines don't come from Astro's logger: they're printed by Vite's HMR client ( 1. Just hide them in DevTools (no code) Almost all of them ( 2. Filter them in code, dev only Wrap the console methods before the Vite client runs. A small integration with // astro.config.mjs
import { defineConfig } from 'astro/config';
const quietViteLogs = {
name: 'quiet-vite-logs',
hooks: {
'astro:config:setup': ({ command, injectScript }) => {
if (command !== 'dev') return;
injectScript('head-inline', `
(() => {
const shouldDrop = (args) => {
const text = args.map(String).join(' ');
return text.startsWith('[vite]') && /hot updated|connect/.test(text);
};
for (const level of ['debug', 'log', 'info']) {
const original = console[level].bind(console);
console[level] = (...args) => { if (!shouldDrop(args)) original(...args); };
}
})();
`);
},
},
};
export default defineConfig({
integrations: [quietViteLogs],
});Adjust the regex in I'd leave Checked against Vite 8.0 ( |
Uh oh!
There was an error while loading. Please reload this page.
How can I customize astro logging output in browser? I want to change or ignore some lines like if it starts with
[vite]and contains some word.All reactions