MCPcopy Index your code
hub / github.com/codeaashu/claude-code / patchConsole

Method patchConsole

src/ink/ink.tsx:1571–1590  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1569 this.backFrame.screen.hyperlinkPool = this.hyperlinkPool;
1570 }
1571 patchConsole(): () => void {
1572 // biome-ignore lint/suspicious/noConsole: intentionally patching global console
1573 const con = console;
1574 const originals: Partial<Record<keyof Console, Console[keyof Console]>> = {};
1575 const toDebug = (...args: unknown[]) => logForDebugging(`console.log: ${format(...args)}`);
1576 const toError = (...args: unknown[]) => logError(new Error(`console.error: ${format(...args)}`));
1577 for (const m of CONSOLE_STDOUT_METHODS) {
1578 originals[m] = con[m];
1579 con[m] = toDebug;
1580 }
1581 for (const m of CONSOLE_STDERR_METHODS) {
1582 originals[m] = con[m];
1583 con[m] = toError;
1584 }
1585 originals.assert = con.assert;
1586 con.assert = (condition: unknown, ...args: unknown[]) => {
1587 if (!condition) toError(...args);
1588 };
1589 return () => Object.assign(con, originals);
1590 }
1591
1592 /**
1593 * Intercept process.stderr.write so stray writes (config.ts, hooks.ts,

Callers 1

constructorMethod · 0.95

Calls 1

toErrorFunction · 0.85

Tested by

no test coverage detected