fix(logging): Ensure sandbox startup messages are routed to stderr (#5725)

This commit is contained in:
Allen Hutchison 2025-08-06 17:19:10 -07:00 committed by GitHub
parent 99f88851fb
commit d6a7334279
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 551 additions and 534 deletions

View File

@ -224,7 +224,7 @@ export type Message =
};
export interface ConsoleMessageItem {
type: 'log' | 'warn' | 'error' | 'debug';
type: 'log' | 'warn' | 'error' | 'debug' | 'info';
content: string;
count: number;
}

View File

@ -18,6 +18,7 @@ export class ConsolePatcher {
private originalConsoleWarn = console.warn;
private originalConsoleError = console.error;
private originalConsoleDebug = console.debug;
private originalConsoleInfo = console.info;
private params: ConsolePatcherParams;
@ -30,6 +31,7 @@ export class ConsolePatcher {
console.warn = this.patchConsoleMethod('warn', this.originalConsoleWarn);
console.error = this.patchConsoleMethod('error', this.originalConsoleError);
console.debug = this.patchConsoleMethod('debug', this.originalConsoleDebug);
console.info = this.patchConsoleMethod('info', this.originalConsoleInfo);
}
cleanup = () => {
@ -37,13 +39,14 @@ export class ConsolePatcher {
console.warn = this.originalConsoleWarn;
console.error = this.originalConsoleError;
console.debug = this.originalConsoleDebug;
console.info = this.originalConsoleInfo;
};
private formatArgs = (args: unknown[]): string => util.format(...args);
private patchConsoleMethod =
(
type: 'log' | 'warn' | 'error' | 'debug',
type: 'log' | 'warn' | 'error' | 'debug' | 'info',
originalMethod: (...args: unknown[]) => void,
) =>
(...args: unknown[]) => {

File diff suppressed because it is too large Load Diff