Skip to content

Commit

Permalink
Fix #120159
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Mar 30, 2021
1 parent 9dbdcc4 commit 291cc7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { TelemetryAppenderChannel } from 'vs/platform/telemetry/common/telemetry
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
import { ILogService, ILoggerService, MultiplexLogService, ConsoleLogger } from 'vs/platform/log/common/log';
import { LogLevelChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
import { LogLevelChannelClient, FollowerLogService, LoggerChannelClient } from 'vs/platform/log/common/logIpc';
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
import { combinedDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle';
Expand All @@ -42,7 +42,6 @@ import { StorageDataCleaner } from 'vs/code/electron-browser/sharedProcess/contr
import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner';
import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/services';
import { MessagePortMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog';
import { DiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService';
import { IDiagnosticsService } from 'vs/platform/diagnostics/common/diagnostics';
import { FileService } from 'vs/platform/files/common/fileService';
Expand All @@ -55,7 +54,6 @@ import { UserDataSyncService } from 'vs/platform/userDataSync/common/userDataSyn
import { UserDataSyncStoreService, UserDataSyncStoreManagementService } from 'vs/platform/userDataSync/common/userDataSyncStoreService';
import { UserDataSyncUtilServiceClient, UserDataAutoSyncChannel, UserDataSyncMachinesServiceChannel, UserDataSyncAccountServiceChannel, UserDataSyncStoreManagementServiceChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc';
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
import { LoggerService } from 'vs/platform/log/node/loggerService';
import { UserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSyncLog';
import { UserDataAutoSyncService } from 'vs/platform/userDataSync/electron-sandbox/userDataAutoSyncService';
import { NativeStorageService } from 'vs/platform/storage/electron-sandbox/storageService';
Expand All @@ -79,14 +77,15 @@ import { LocalizationsUpdater } from 'vs/code/electron-browser/sharedProcess/con
import { DeprecatedExtensionsCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/deprecatedExtensionsCleaner';
import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { join } from 'vs/base/common/path';
import { TerminalIpcChannels } from 'vs/platform/terminal/common/terminal';
import { PtyHostService } from 'vs/platform/terminal/node/ptyHostService';
import { ILocalPtyService } from 'vs/platform/terminal/electron-sandbox/terminal';
import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncServiceIpc';
import { IChecksumService } from 'vs/platform/checksum/common/checksumService';
import { ChecksumService } from 'vs/platform/checksum/node/checksumService';
import { CustomEndpointTelemetryService } from 'vs/platform/telemetry/node/customEndpointTelemetryService';
import { URI } from 'vs/base/common/uri';
import { joinPath } from 'vs/base/common/resources';

class SharedProcessMain extends Disposable {

Expand Down Expand Up @@ -148,25 +147,29 @@ class SharedProcessMain extends Disposable {
const productService = { _serviceBrand: undefined, ...product };
services.set(IProductService, productService);

// Main Process
const mainRouter = new StaticRouter(ctx => ctx === 'main');
const mainProcessService = new MessagePortMainProcessService(this.server, mainRouter);
services.set(IMainProcessService, mainProcessService);

// Environment
const environmentService = new NativeEnvironmentService(this.configuration.args, productService);
services.set(INativeEnvironmentService, environmentService);

// Logger
const loggerService = new LoggerChannelClient(mainProcessService.getChannel('logger'));
services.set(ILoggerService, loggerService);

// Log
const mainRouter = new StaticRouter(ctx => ctx === 'main');
const logLevelClient = new LogLevelChannelClient(this.server.getChannel('logLevel', mainRouter)); // we only use this for log levels
const multiplexLogger = this._register(new MultiplexLogService([
this._register(new ConsoleLogger(this.configuration.logLevel)),
this._register(new SpdLogLogger('sharedprocess', join(environmentService.logsPath, 'sharedprocess.log'), true, this.configuration.logLevel))
this._register(loggerService.createLogger(joinPath(URI.file(environmentService.logsPath), 'sharedprocess.log'), { name: 'sharedprocess' }))
]));

const logService = this._register(new FollowerLogService(logLevelClient, multiplexLogger));
services.set(ILogService, logService);

// Main Process
const mainProcessService = new MessagePortMainProcessService(this.server, mainRouter);
services.set(IMainProcessService, mainProcessService);

// Files
const fileService = this._register(new FileService(logService));
services.set(IFileService, fileService);
Expand Down Expand Up @@ -205,10 +208,6 @@ class SharedProcessMain extends Disposable {
const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id));
services.set(IExtensionRecommendationNotificationService, new ExtensionRecommendationNotificationServiceChannelClient(this.server.getChannel('extensionRecommendationNotification', activeWindowRouter)));

// Logger
const loggerService = this._register(new LoggerService(logService, fileService));
services.set(ILoggerService, loggerService);

// Telemetry
const { appRoot, extensionsPath, extensionDevelopmentLocationURI, isBuilt, installSourcePath } = environmentService;

Expand Down
1 change: 1 addition & 0 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ export class CodeApplication extends Disposable {
// Logger
const loggerChannel = new LoggerChannel(accessor.get(ILoggerService),);
mainProcessElectronServer.registerChannel('logger', loggerChannel);
sharedProcessClient.then(client => client.registerChannel('logger', loggerChannel));

// Extension Host Debug Broadcasting
const electronExtensionHostDebugBroadcastChannel = new ElectronExtensionHostDebugBroadcastChannel(accessor.get(IWindowsMainService));
Expand Down

0 comments on commit 291cc7c

Please sign in to comment.