MCPcopy
hub / github.com/microsoft/vscode / wrapConsoleMethod

Function wrapConsoleMethod

src/bootstrap-fork.ts:105–110  ·  view source on GitHub ↗

* Wraps a console message so that it is transmitted to the renderer. * * The wrapped property is not defined with `writable: false` to avoid * throwing errors, but rather a no-op setting. See https://github.com/microsoft/vscode-extension-telemetry/issues/88

(method: 'log' | 'info' | 'warn' | 'error', severity: 'log' | 'warn' | 'error')

Source from the content-addressed store, hash-verified

103 * throwing errors, but rather a no-op setting. See https://github.com/microsoft/vscode-extension-telemetry/issues/88
104 */
105 function wrapConsoleMethod(method: 'log' | 'info' | 'warn' | 'error', severity: 'log' | 'warn' | 'error'): void {
106 Object.defineProperty(console, method, {
107 set: () => { },
108 get: () => function () { safeSendConsoleMessage(severity, safeToString(arguments)); },
109 });
110 }
111
112 /**
113 * Wraps process.stderr/stdout.write() so that it is transmitted to the

Callers 1

pipeLoggingToParentFunction · 0.85

Calls 2

safeSendConsoleMessageFunction · 0.85
safeToStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…