From 1cd289c3c85406b6831681721dae952e9a27e877 Mon Sep 17 00:00:00 2001 From: Colin Grant Date: Fri, 24 Feb 2023 10:25:23 -0700 Subject: [PATCH] Reduce plugin logging --- .../src/node/plugin-vscode-directory-handler.ts | 2 +- .../plugin-ext/src/hosted/browser/hosted-plugin.ts | 10 ++++++---- .../src/hosted/node/hosted-plugin-deployer-handler.ts | 2 +- packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts | 4 ++-- .../node/handlers/plugin-theia-directory-handler.ts | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/plugin-ext-vscode/src/node/plugin-vscode-directory-handler.ts b/packages/plugin-ext-vscode/src/node/plugin-vscode-directory-handler.ts index 140c1e0eb4438..d3e45f86648c7 100644 --- a/packages/plugin-ext-vscode/src/node/plugin-vscode-directory-handler.ts +++ b/packages/plugin-ext-vscode/src/node/plugin-vscode-directory-handler.ts @@ -121,7 +121,7 @@ export class PluginVsCodeDirectoryHandler implements PluginDeployerDirectoryHand plugin.rootPath = plugin.path(); plugin.updatePath(pluginPath); } - console.log(`Resolved "${plugin.id()}" to a VS Code extension "${pck.name}@${pck.version}" with engines:`, pck.engines); + console.debug(`Resolved "${plugin.id()}" to a VS Code extension "${pck.name}@${pck.version}" with engines:`, pck.engines); return true; } diff --git a/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts b/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts index 7ad4d14d07dde..594e687421f7a 100644 --- a/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts +++ b/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts @@ -375,6 +375,7 @@ export class HostedPluginSupport { const loadPluginsMeasurement = this.measure('loadPlugins'); const hostContributions = new Map(); + console.log(`[${this.clientId}] Loading plugin contributions`); for (const contributions of this.contributions.values()) { const plugin = contributions.plugin.metadata; const pluginId = plugin.model.id; @@ -384,7 +385,7 @@ export class HostedPluginSupport { contributions.push(Disposable.create(() => console.log(`[${pluginId}]: Unloaded plugin.`))); contributions.push(this.contributionHandler.handleContributions(this.clientId, contributions.plugin)); contributions.state = PluginContributions.State.LOADED; - console.log(`[${this.clientId}][${pluginId}]: Loaded contributions.`); + console.debug(`[${this.clientId}][${pluginId}]: Loaded contributions.`); loaded++; } @@ -396,7 +397,7 @@ export class HostedPluginSupport { hostContributions.set(host, dynamicContributions); toDisconnect.push(Disposable.create(() => { contributions!.state = PluginContributions.State.LOADED; - console.log(`[${this.clientId}][${pluginId}]: Disconnected.`); + console.debug(`[${this.clientId}][${pluginId}]: Disconnected.`); })); } } @@ -446,14 +447,15 @@ export class HostedPluginSupport { if (toDisconnect.disposed) { return; } + console.log(`[${this.clientId}] Starting plugins.`); for (const contributions of hostContributions) { started++; const plugin = contributions.plugin; const id = plugin.metadata.model.id; contributions.state = PluginContributions.State.STARTED; - console.log(`[${this.clientId}][${id}]: Started plugin.`); + console.debug(`[${this.clientId}][${id}]: Started plugin.`); toDisconnect.push(contributions.push(Disposable.create(() => { - console.log(`[${this.clientId}][${id}]: Stopped plugin.`); + console.debug(`[${this.clientId}][${id}]: Stopped plugin.`); manager.$stop(id); }))); diff --git a/packages/plugin-ext/src/hosted/node/hosted-plugin-deployer-handler.ts b/packages/plugin-ext/src/hosted/node/hosted-plugin-deployer-handler.ts index 7adc82316703b..cd45a3a378401 100644 --- a/packages/plugin-ext/src/hosted/node/hosted-plugin-deployer-handler.ts +++ b/packages/plugin-ext/src/hosted/node/hosted-plugin-deployer-handler.ts @@ -176,7 +176,7 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler { deployed.contributes = this.reader.readContribution(manifest); this.localizationService.deployLocalizations(deployed); deployedPlugins.set(id, deployed); - deployPlugin.log(`Deployed ${entryPoint} plugin "${id}" from "${metadata.model.entryPoint[entryPoint] || pluginPath}"`); + deployPlugin.debug(`Deployed ${entryPoint} plugin "${id}" from "${metadata.model.entryPoint[entryPoint] || pluginPath}"`); } catch (e) { deployPlugin.error(`Failed to deploy ${entryPoint} plugin from '${pluginPath}' path`, e); return success = false; diff --git a/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts b/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts index 95581f0c53738..eb36ca2121c41 100644 --- a/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts +++ b/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts @@ -91,7 +91,7 @@ export class PluginHostRPC { initContext(contextPath: string, plugin: Plugin): void { const { name, version } = plugin.rawModel; - console.log('PLUGIN_HOST(' + process.pid + '): initializing(' + name + '@' + version + ' with ' + contextPath + ')'); + console.debug('PLUGIN_HOST(' + process.pid + '): initializing(' + name + '@' + version + ' with ' + contextPath + ')'); try { const backendInit = dynamicRequire<{ doInitialization: BackendInitializationFn }>(contextPath); backendInit.doInitialization(this.apiFactory, plugin); @@ -111,7 +111,7 @@ export class PluginHostRPC { const pluginManager = new PluginManagerExtImpl({ // eslint-disable-next-line @typescript-eslint/no-explicit-any loadPlugin(plugin: Plugin): any { - console.log('PLUGIN_HOST(' + process.pid + '): PluginManagerExtImpl/loadPlugin(' + plugin.pluginPath + ')'); + console.debug('PLUGIN_HOST(' + process.pid + '): PluginManagerExtImpl/loadPlugin(' + plugin.pluginPath + ')'); // cleaning the cache for all files of that plug-in. Object.keys(require.cache).forEach(function (key): void { const mod: NodeJS.Module = require.cache[key]!; diff --git a/packages/plugin-ext/src/main/node/handlers/plugin-theia-directory-handler.ts b/packages/plugin-ext/src/main/node/handlers/plugin-theia-directory-handler.ts index 80ba6bf4ee2b5..9a72946bcb5c9 100644 --- a/packages/plugin-ext/src/main/node/handlers/plugin-theia-directory-handler.ts +++ b/packages/plugin-ext/src/main/node/handlers/plugin-theia-directory-handler.ts @@ -34,7 +34,7 @@ export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandl accept(resolvedPlugin: PluginDeployerEntry): boolean { - console.log('PluginTheiaDirectoryHandler: accepting plugin with path', resolvedPlugin.path()); + console.debug('PluginTheiaDirectoryHandler: accepting plugin with path', resolvedPlugin.path()); // handle only directories if (resolvedPlugin.isFile()) {