add suppressConsoleOutput

This commit is contained in:
Cynthia Long
2026-03-16 18:22:10 +00:00
parent fd62938945
commit db9eef50ef
4 changed files with 9 additions and 2 deletions
@@ -13,6 +13,7 @@ interface ConsolePatcherParams {
onNewMessage?: (message: Omit<ConsoleMessageItem, 'id'>) => void;
debugMode: boolean;
stderr?: boolean;
suppressConsoleOutput?: boolean;
}
export class ConsolePatcher {
@@ -49,6 +50,10 @@ export class ConsolePatcher {
private patchConsoleMethod =
(type: 'log' | 'warn' | 'error' | 'debug' | 'info') =>
(...args: unknown[]) => {
if (this.params.suppressConsoleOutput && !this.params.debugMode) {
return;
}
if (this.params.stderr) {
if (type !== 'debug' || this.params.debugMode) {
this.originalConsoleError(this.formatArgs(args));