Skip to content

Commit 08e74c3

Browse files
Ignore all-whitespace vite logs (#48)
1 parent 4589697 commit 08e74c3

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/logger/instrumentation.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,19 @@ function patchConsole(): void {
6262
.map(stripAnsiCodes)
6363
.join(' ');
6464

65-
circularBuffer.addLog({
66-
timestamp: new Date().toISOString(),
67-
severityText: severity,
68-
body,
69-
attributes: {
70-
'log.origin': 'console',
71-
'log.method': method,
72-
},
73-
});
65+
const isAllWhitespace = body.match(/^\s+$/);
66+
67+
if (!isAllWhitespace) {
68+
circularBuffer.addLog({
69+
timestamp: new Date().toISOString(),
70+
severityText: severity,
71+
body,
72+
attributes: {
73+
'log.origin': 'console',
74+
'log.method': method,
75+
},
76+
});
77+
}
7478
} catch {
7579
// Silently fail to avoid breaking console
7680
}

0 commit comments

Comments
 (0)