hook up log service in shared and main processes

This commit is contained in:
Joao Moreno
2017-11-30 10:04:16 +01:00
parent 4c79dc1f0c
commit 9b3478b66d
6 changed files with 64 additions and 11 deletions
@@ -35,6 +35,8 @@ import { WindowsChannelClient } from 'vs/platform/windows/common/windowsIpc';
import { ipcRenderer } from 'electron';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { createSharedProcessContributions } from 'vs/code/electron-browser/contrib/contributions';
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
import { ILogService } from 'vs/platform/log/common/log';
export interface ISharedProcessConfiguration {
readonly machineId: string;
@@ -76,7 +78,12 @@ const eventPrefix = 'monacoworkbench';
function main(server: Server, initData: ISharedProcessInitData, configuration: ISharedProcessConfiguration): void {
const services = new ServiceCollection();
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, initData.args, process.execPath));
const environmentService = new EnvironmentService(initData.args, process.execPath);
const logService = new SpdLogService('sharedprocess', environmentService);
logService.info('main', JSON.stringify(configuration));
services.set(IEnvironmentService, environmentService);
services.set(ILogService, logService);
services.set(IConfigurationService, new SyncDescriptor(ConfigurationService));
services.set(IRequestService, new SyncDescriptor(RequestService));
+9 -3
View File
@@ -21,7 +21,7 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ILogService, LegacyLogMainService } from 'vs/platform/log/common/log';
import { ILogService, LegacyLogMainService, MultiplexLogService } from 'vs/platform/log/common/log';
import { StateService } from 'vs/platform/state/node/stateService';
import { IStateService } from 'vs/platform/state/common/state';
import { IBackupMainService } from 'vs/platform/backup/common/backup';
@@ -46,12 +46,18 @@ import { localize } from 'vs/nls';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
import { listProcesses, ProcessItem } from 'vs/base/node/ps';
import { repeat, pad } from 'vs/base/common/strings';
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
function createServices(args: ParsedArgs): IInstantiationService {
const services = new ServiceCollection();
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, args, process.execPath));
services.set(ILogService, new SyncDescriptor(LegacyLogMainService, 'main'));
const environmentService = new EnvironmentService(args, process.execPath);
const spdlogService = new SpdLogService('main', environmentService);
const legacyLogService = new LegacyLogMainService(environmentService);
const logService = new MultiplexLogService([legacyLogService, spdlogService]);
services.set(IEnvironmentService, environmentService);
services.set(ILogService, logService);
services.set(IWorkspacesMainService, new SyncDescriptor(WorkspacesMainService));
services.set(IHistoryMainService, new SyncDescriptor(HistoryMainService));
services.set(ILifecycleService, new SyncDescriptor(LifecycleService));