This commit is contained in:
Sandeep Somavarapu
2018-01-24 08:25:23 +01:00
parent 6bfe9bbe8a
commit 1b54bafade
4 changed files with 22 additions and 25 deletions

View File

@@ -38,8 +38,8 @@ import { ipcRenderer } from 'electron';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { createSharedProcessContributions } from 'vs/code/electron-browser/sharedProcess/contrib/contributions';
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
import { ILogService, FollowerLogService, LogLevel } from 'vs/platform/log/common/log';
import { LogLevelSetterChannelClient } from 'vs/platform/log/common/logIpc';
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
import { LogLevelSetterChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
export interface ISharedProcessConfiguration {
readonly machineId: string;

View File

@@ -23,15 +23,12 @@ export enum LogLevel {
Off
}
export interface ILogLevelSetter {
onDidChangeLogLevel: Event<LogLevel>;
setLevel(level: LogLevel): void;
}
export interface ILogService extends ILogLevelSetter, IDisposable {
export interface ILogService extends IDisposable {
_serviceBrand: any;
onDidChangeLogLevel: Event<LogLevel>;
getLevel(): LogLevel;
setLevel(level: LogLevel): void;
trace(message: string, ...args: any[]): void;
debug(message: string, ...args: any[]): void;
info(message: string, ...args: any[]): void;
@@ -290,19 +287,6 @@ export class DelegatedLogService extends Disposable implements ILogService {
}
}
export class FollowerLogService extends DelegatedLogService implements ILogService {
_serviceBrand: any;
constructor(private master: ILogLevelSetter, logService: ILogService) {
super(logService);
this._register(master.onDidChangeLogLevel(level => logService.setLevel(level)));
}
setLevel(level: LogLevel): void {
this.master.setLevel(level);
}
}
export class NullLogService implements ILogService {
_serviceBrand: any;
readonly onDidChangeLogLevel: Event<LogLevel> = new Emitter<LogLevel>().event;

View File

@@ -5,7 +5,7 @@
import { IChannel, eventToCall, eventFromCall } from 'vs/base/parts/ipc/common/ipc';
import { TPromise } from 'vs/base/common/winjs.base';
import { LogLevel, ILogService, ILogLevelSetter } from 'vs/platform/log/common/log';
import { LogLevel, ILogService, DelegatedLogService } from 'vs/platform/log/common/log';
import Event, { buffer } from 'vs/base/common/event';
export interface ILogLevelSetterChannel extends IChannel {
@@ -30,7 +30,7 @@ export class LogLevelSetterChannel implements ILogLevelSetterChannel {
}
}
export class LogLevelSetterChannelClient implements ILogLevelSetter {
export class LogLevelSetterChannelClient {
constructor(private channel: ILogLevelSetterChannel) { }
@@ -40,4 +40,17 @@ export class LogLevelSetterChannelClient implements ILogLevelSetter {
setLevel(level: LogLevel): TPromise<void> {
return this.channel.call('setLevel', level);
}
}
export class FollowerLogService extends DelegatedLogService implements ILogService {
_serviceBrand: any;
constructor(private master: LogLevelSetterChannelClient, logService: ILogService) {
super(logService);
this._register(master.onDidChangeLogLevel(level => logService.setLevel(level)));
}
setLevel(level: LogLevel): void {
this.master.setLevel(level);
}
}

View File

@@ -43,10 +43,10 @@ import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
import fs = require('fs');
import { ConsoleLogService, MultiplexLogService, ILogService, FollowerLogService } from 'vs/platform/log/common/log';
import { ConsoleLogService, MultiplexLogService, ILogService } from 'vs/platform/log/common/log';
import { IssueChannelClient } from 'vs/platform/issue/common/issueIpc';
import { IIssueService } from 'vs/platform/issue/common/issue';
import { LogLevelSetterChannelClient } from 'vs/platform/log/common/logIpc';
import { LogLevelSetterChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
gracefulFs.gracefulify(fs); // enable gracefulFs
export function startup(configuration: IWindowConfiguration): TPromise<void> {