提交 bd929b33 编写于 作者: B Benjamin Pasero

logging - put storage tracing behind a flag to reduce spam

上级 b9c67304
......@@ -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;
}
......
......@@ -322,7 +322,7 @@ class SharedProcessMain extends Disposable {
return;
}
logService.error(message);
logService.error(`[uncaught exception in sharedProcess]: ${message}`);
});
}
}
......
......@@ -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);
}
}
......
......@@ -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 {
......
......@@ -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
......
......@@ -178,7 +178,7 @@ class CliMain extends Disposable {
return;
}
logService.error(message);
logService.error(`[uncaught exception in CLI]: ${message}`);
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册