diff --git a/src/vs/base/parts/storage/node/storage.ts b/src/vs/base/parts/storage/node/storage.ts index d6eca3ac03f00e63084299981a28d7e5379924ae..b99c08a358fa0625cba24067d08977a34acd8afb 100644 --- a/src/vs/base/parts/storage/node/storage.ts +++ b/src/vs/base/parts/storage/node/storage.ts @@ -412,11 +412,17 @@ export class SQLiteStorageDatabase implements IStorageDatabase { } class SQLiteStorageDatabaseLogger { + + // to reduce lots of output, require an environment variable to enable tracing + // this helps when running with --verbose normally where the storage tracing + // might hide useful output to look at + static readonly VSCODE_TRACE_STORAGE = 'VSCODE_TRACE_STORAGE'; + private readonly logTrace: ((msg: string) => void) | undefined; private readonly logError: ((error: string | Error) => void) | undefined; constructor(options?: ISQLiteStorageDatabaseLoggingOptions) { - if (options && typeof options.logTrace === 'function') { + if (options && typeof options.logTrace === 'function' && process.env[SQLiteStorageDatabaseLogger.VSCODE_TRACE_STORAGE]) { this.logTrace = options.logTrace; } diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 345404e4499f2a2eec677f8e47500485fb91182b..3aa7cce16e8ed3bed3a27c9de761a40674d17fad 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -322,7 +322,7 @@ class SharedProcessMain extends Disposable { return; } - logService.error(message); + logService.error(`[uncaught exception in sharedProcess]: ${message}`); }); } } diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 9150c1da288fbf0702217d03e1f0919f227ee2c6..3f85072d57173d55b66639bb567dd749f7688ea2 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -149,19 +149,19 @@ export class CodeApplication extends Disposable { event.preventDefault(); }); app.on('remote-get-global', (event, sender, module) => { - this.logService.trace(`App#on(remote-get-global): prevented on ${module}`); + this.logService.trace(`app#on(remote-get-global): prevented on ${module}`); event.preventDefault(); }); app.on('remote-get-builtin', (event, sender, module) => { - this.logService.trace(`App#on(remote-get-builtin): prevented on ${module}`); + this.logService.trace(`app#on(remote-get-builtin): prevented on ${module}`); if (module !== 'clipboard') { event.preventDefault(); } }); app.on('remote-get-current-window', event => { - this.logService.trace(`App#on(remote-get-current-window): prevented`); + this.logService.trace(`app#on(remote-get-current-window): prevented`); event.preventDefault(); }); @@ -170,7 +170,7 @@ export class CodeApplication extends Disposable { return; // the driver needs access to web contents } - this.logService.trace(`App#on(remote-get-current-web-contents): prevented`); + this.logService.trace(`app#on(remote-get-current-web-contents): prevented`); event.preventDefault(); }); @@ -921,8 +921,8 @@ export class CodeApplication extends Disposable { const WindowsMutex = (require.__$__nodeRequire('windows-mutex') as typeof import('windows-mutex')).Mutex; const mutex = new WindowsMutex(win32MutexName); once(this.lifecycleMainService.onWillShutdown)(() => mutex.release()); - } catch (e) { - this.logService.error(e); + } catch (error) { + this.logService.error(error); } } diff --git a/src/vs/code/electron-main/sharedProcess.ts b/src/vs/code/electron-main/sharedProcess.ts index f060b0ffdf5330a772a2a5aeabd0b34f72a356e4..812a4dd1e975bfb2deda57305cc37904222bf13a 100644 --- a/src/vs/code/electron-main/sharedProcess.ts +++ b/src/vs/code/electron-main/sharedProcess.ts @@ -202,9 +202,9 @@ export class SharedProcess extends Disposable implements ISharedProcess { this.window.on('close', this.windowCloseListener); // Crashes & Unrsponsive & Failed to load - this.window.webContents.on('render-process-gone', (event, details) => this.logService.error(`[VS Code]: sharedProcess crashed (detail: ${details?.reason})`)); - this.window.on('unresponsive', () => this.logService.error('[VS Code]: detected unresponsive sharedProcess window')); - this.window.webContents.on('did-fail-load', (event, errorCode, errorDescription) => this.logService.warn('[VS Code]: fail to load sharedProcess window, ', errorDescription)); + this.window.webContents.on('render-process-gone', (event, details) => this.logService.error(`SharedProcess: crashed (detail: ${details?.reason})`)); + this.window.on('unresponsive', () => this.logService.error('SharedProcess: detected unresponsive window')); + this.window.webContents.on('did-fail-load', (event, errorCode, errorDescription) => this.logService.warn('SharedProcess: failed to load window, ', errorDescription)); } spawn(userEnv: NodeJS.ProcessEnv): void { diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index ec9cdf004e746d9ce40c0e7b611fb6846008e937..eadfba7eb78db4465f480553708d9713cea87db3 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -413,7 +413,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { // Crashes & Unrsponsive & Failed to load this._win.webContents.on('render-process-gone', (event, details) => this.onWindowError(WindowError.CRASHED, details)); this._win.on('unresponsive', () => this.onWindowError(WindowError.UNRESPONSIVE)); - this._win.webContents.on('did-fail-load', (event, errorCode, errorDescription) => this.logService.warn('[VS Code]: fail to load workbench window, ', errorDescription)); + this._win.webContents.on('did-fail-load', (event, errorCode, errorDescription) => this.logService.warn('Main: failed to load workbench window, ', errorDescription)); // Window close this._win.on('closed', () => { @@ -552,7 +552,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { private onWindowError(error: WindowError.UNRESPONSIVE): void; private onWindowError(error: WindowError.CRASHED, details: RenderProcessGoneDetails): void; private onWindowError(error: WindowError, details?: RenderProcessGoneDetails): void { - this.logService.error(error === WindowError.CRASHED ? `[VS Code]: renderer process crashed (detail: ${details?.reason})` : '[VS Code]: detected unresponsive'); + this.logService.error(error === WindowError.CRASHED ? `Main: renderer process crashed (detail: ${details?.reason})` : 'Main: detected unresponsive'); // If we run extension tests from CLI, showing a dialog is not // very helpful in this case. Rather, we bring down the test run diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index c935723ec65020f81aed4c513bb569c575945a0a..ee189f83229658867980d167ec942f4334babf8c 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -178,7 +178,7 @@ class CliMain extends Disposable { return; } - logService.error(message); + logService.error(`[uncaught exception in CLI]: ${message}`); }); }