Skip to content

Commit

Permalink
Adjusted the plug-in related logging.
Browse files Browse the repository at this point in the history
 - Got rid of the empty lines between the log entries.
 - Log the plug-in `name` and `version` when initializing.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
  • Loading branch information
Akos Kitta authored and kittaakos committed Jul 4, 2019
1 parent 37c9659 commit 20251ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { HostedPluginClient, ServerPluginRunner, PluginMetadata, PluginHostEnvir
import { RPCProtocolImpl } from '../../api/rpc-protocol';
import { MAIN_RPC_CONTEXT } from '../../api/plugin-api';
import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution';
import {HostedPluginProcessesCache} from './hosted-plugin-processes-cache';
import { HostedPluginProcessesCache } from './hosted-plugin-processes-cache';

export interface IPCConnectionOptions {
readonly serverName: string;
Expand Down Expand Up @@ -180,8 +180,8 @@ export class HostedPluginProcess implements ServerPluginRunner {
}

const childProcess = cp.fork(path.resolve(__dirname, 'plugin-host.js'), options.args, forkOptions);
childProcess.stdout.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString()}`));
childProcess.stderr.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString()}`));
childProcess.stdout.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));
childProcess.stderr.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString().trim()}`));

this.logger.debug(`[${options.serverName}: ${childProcess.pid}] IPC started`);
childProcess.once('exit', () => this.logger.debug(`[${options.serverName}: ${childProcess.pid}] IPC exited`));
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class PluginHostRPC {

// tslint:disable-next-line:no-any
initContext(contextPath: string, plugin: Plugin): any {
console.log('PLUGIN_HOST(' + process.pid + '): initializing(' + contextPath + ')');
const { name, version } = plugin.rawModel;
console.log('PLUGIN_HOST(' + process.pid + '): initializing(' + name + '@' + version + ' with ' + contextPath + ')');
try {
const backendInit = require(contextPath);
backendInit.doInitialization(this.apiFactory, plugin);
Expand Down

0 comments on commit 20251ea

Please sign in to comment.