Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)

* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f

* fix various icon issues

* fix preview features
This commit is contained in:
Anthony Dresser
2019-09-19 21:50:52 -07:00
committed by GitHub
parent 9d3d64eef3
commit db498db0a8
459 changed files with 10195 additions and 7528 deletions

View File

@@ -8,6 +8,7 @@ import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { isWindows } from 'vs/base/common/platform';
import { Event, Emitter } from 'vs/base/common/event';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { LoggerChannelClient } from 'vs/platform/log/common/logIpc';
export const ILogService = createServiceDecorator<ILogService>('logService');
@@ -183,6 +184,54 @@ export class ConsoleLogService extends AbstractLogService implements ILogService
dispose(): void { }
}
export class ConsoleLogInMainService extends AbstractLogService implements ILogService {
_serviceBrand: undefined;
constructor(private readonly client: LoggerChannelClient, logLevel: LogLevel = DEFAULT_LOG_LEVEL) {
super();
this.setLevel(logLevel);
}
trace(message: string, ...args: any[]): void {
if (this.getLevel() <= LogLevel.Trace) {
this.client.consoleLog('trace', [message, ...args]);
}
}
debug(message: string, ...args: any[]): void {
if (this.getLevel() <= LogLevel.Debug) {
this.client.consoleLog('debug', [message, ...args]);
}
}
info(message: string, ...args: any[]): void {
if (this.getLevel() <= LogLevel.Info) {
this.client.consoleLog('info', [message, ...args]);
}
}
warn(message: string | Error, ...args: any[]): void {
if (this.getLevel() <= LogLevel.Warning) {
this.client.consoleLog('warn', [message, ...args]);
}
}
error(message: string, ...args: any[]): void {
if (this.getLevel() <= LogLevel.Error) {
this.client.consoleLog('error', [message, ...args]);
}
}
critical(message: string, ...args: any[]): void {
if (this.getLevel() <= LogLevel.Critical) {
this.client.consoleLog('critical', [message, ...args]);
}
}
dispose(): void { }
}
export class MultiplexLogService extends AbstractLogService implements ILogService {
_serviceBrand: undefined;
@@ -326,4 +375,4 @@ export function getLogLevel(environmentService: IEnvironmentService): LogLevel {
}
}
return DEFAULT_LOG_LEVEL;
}
}

View File

@@ -7,7 +7,7 @@ import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { LogLevel, ILogService, DelegatedLogService } from 'vs/platform/log/common/log';
import { Event } from 'vs/base/common/event';
export class LogLevelSetterChannel implements IServerChannel {
export class LoggerChannel implements IServerChannel {
onDidChangeLogLevel: Event<LogLevel>;
@@ -26,13 +26,32 @@ export class LogLevelSetterChannel implements IServerChannel {
call(_: unknown, command: string, arg?: any): Promise<any> {
switch (command) {
case 'setLevel': this.service.setLevel(arg); return Promise.resolve();
case 'consoleLog': this.consoleLog(arg[0], arg[1]); return Promise.resolve();
}
throw new Error(`Call not found: ${command}`);
}
private consoleLog(severity: string, args: string[]): void {
let consoleFn = console.log;
switch (severity) {
case 'error':
consoleFn = console.error;
break;
case 'warn':
consoleFn = console.warn;
break;
case 'info':
consoleFn = console.info;
break;
}
consoleFn.call(console, ...args);
}
}
export class LogLevelSetterChannelClient {
export class LoggerChannelClient {
constructor(private channel: IChannel) { }
@@ -43,12 +62,16 @@ export class LogLevelSetterChannelClient {
setLevel(level: LogLevel): void {
this.channel.call('setLevel', level);
}
consoleLog(severity: string, args: string[]): void {
this.channel.call('consoleLog', [severity, args]);
}
}
export class FollowerLogService extends DelegatedLogService implements ILogService {
_serviceBrand: undefined;
constructor(private master: LogLevelSetterChannelClient, logService: ILogService) {
constructor(private master: LoggerChannelClient, logService: ILogService) {
super(logService);
this._register(master.onDidChangeLogLevel(level => logService.setLevel(level)));
}
@@ -56,4 +79,4 @@ export class FollowerLogService extends DelegatedLogService implements ILogServi
setLevel(level: LogLevel): void {
this.master.setLevel(level);
}
}
}