Skip to content

Commit 350ddc3

Browse files
committed
fix(lib/vscode): update log service in server.ts
This required a bit more work. We moved a few things around and made use of multiplexLogService.
1 parent eaf63de commit 350ddc3

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

lib/vscode/src/vs/server/node/server.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
2929
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
3030
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
3131
import { ConsoleLogger, getLogLevel, ILoggerService, ILogService, MultiplexLogService } from 'vs/platform/log/common/log';
32-
import { FollowerLogService, LoggerChannel, LoggerChannelClient } from 'vs/platform/log/common/logIpc';
32+
import { LoggerChannel } from 'vs/platform/log/common/logIpc';
3333
import { LoggerService } from 'vs/platform/log/node/loggerService';
3434
import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog';
3535
import product from 'vs/platform/product/common/product';
@@ -217,25 +217,30 @@ export class Vscode {
217217
https://github.com/cdr/code-server/blob/main/lib/vscode/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L148
218218
219219
If upstream changes cause conflicts, look there ^.
220+
3/11/21 @jsjoeio
220221
*/
221222
const environmentService = new NativeEnvironmentService(args);
222223
// https://github.com/cdr/code-server/issues/1693
223224
fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true });
224225
/*
225-
NOTE@coder: Made these updates on 3/11/21 by @jsjoeio
226-
based on this file (and lines):
226+
NOTE@coder: Made these updates on based on this file (and lines):
227227
https://github.com/cdr/code-server/blob/main/lib/vscode/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L144-L149
228+
229+
More details (from @code-asher):
230+
I think the logLevel channel is only used in the electron version of vscode so we can probably skip it.
231+
With that in mind we wouldn't need logLevelClient which means we wouldn't need the follower service
232+
either and we can use the multiplex log service directly.
233+
3/11/21 @jsjoeio
228234
*/
229-
const mainRouter = new StaticRouter(ctx => ctx === 'main')
230-
const loggerClient = new LoggerChannelClient(this.ipc.getChannel('logger', mainRouter))
231-
const multiplexLogger = new MultiplexLogService([
235+
const logService = new MultiplexLogService([
232236
new ConsoleLogger(getLogLevel(environmentService)),
233237
new SpdLogLogger(RemoteExtensionLogFileName, environmentService.logsPath, false, getLogLevel(environmentService))
234238
])
235-
const logService = new FollowerLogService(loggerClient, multiplexLogger)
236239
const fileService = new FileService(logService);
237240
fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(logService));
238241

242+
const loggerService = new LoggerService(logService, fileService)
243+
239244
const piiPaths = [
240245
path.join(environmentService.userDataPath, 'clp'), // Language packs.
241246
environmentService.appRoot,
@@ -245,13 +250,17 @@ export class Vscode {
245250
...environmentService.extraBuiltinExtensionPaths,
246251
];
247252

248-
this.ipc.registerChannel('logger', new LoggerChannel(logService));
253+
this.ipc.registerChannel('logger', new LoggerChannel(loggerService));
249254
this.ipc.registerChannel(ExtensionHostDebugBroadcastChannel.ChannelName, new ExtensionHostDebugBroadcastChannel());
250255

251256
this.services.set(ILogService, logService);
252257
this.services.set(IEnvironmentService, environmentService);
253258
this.services.set(INativeEnvironmentService, environmentService);
254-
this.services.set(ILoggerService, new SyncDescriptor(LoggerService));
259+
/*
260+
NOTE@coder: we changed this from LoggerService to the loggerService defined above.
261+
3/11/21 @jsjoeio
262+
*/
263+
this.services.set(ILoggerService, loggerService);
255264

256265
const configurationService = new ConfigurationService(environmentService.settingsResource, fileService);
257266
await configurationService.initialize();

0 commit comments

Comments
 (0)