Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -5,37 +5,246 @@
'use strict';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { createDecorator as createServiceDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable } from 'vs/base/common/lifecycle';
import { isWindows } from 'vs/base/common/platform';
export const ILogService = createDecorator<ILogService>('logService');
export const ILogService = createServiceDecorator<ILogService>('logService');
export interface ILogService {
_serviceBrand: any;
log(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
export enum LogLevel {
Trace,
Debug,
Info,
Warning,
Error,
Critical,
Off
}
export class LogMainService implements ILogService {
export interface ILogService extends IDisposable {
_serviceBrand: any;
constructor( @IEnvironmentService private environmentService: IEnvironmentService) {
setLevel(level: LogLevel): void;
getLevel(): LogLevel;
trace(message: string, ...args: any[]): void;
debug(message: string, ...args: any[]): void;
info(message: string, ...args: any[]): void;
warn(message: string, ...args: any[]): void;
error(message: string | Error, ...args: any[]): void;
critical(message: string | Error, ...args: any[]): void;
}
export class ConsoleLogMainService implements ILogService {
_serviceBrand: any;
private level: LogLevel = LogLevel.Error;
private useColors: boolean;
constructor( @IEnvironmentService environmentService: IEnvironmentService) {
this.setLevel(environmentService.logLevel);
this.useColors = !isWindows;
}
public log(...args: any[]): void {
if (this.environmentService.verbose) {
console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
setLevel(level: LogLevel): void {
this.level = level;
}
getLevel(): LogLevel {
return this.level;
}
trace(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Trace) {
if (this.useColors) {
console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, message, ...args);
} else {
console.log(`[main ${new Date().toLocaleTimeString()}]`, message, ...args);
}
}
}
public error(...args: any[]): void {
console.error(`\x1b[91m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
debug(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Debug) {
if (this.useColors) {
console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, message, ...args);
} else {
console.log(`[main ${new Date().toLocaleTimeString()}]`, message, ...args);
}
}
}
public warn(...args: any[]): void {
console.warn(`\x1b[93m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
info(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Info) {
if (this.useColors) {
console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, message, ...args);
} else {
console.log(`[main ${new Date().toLocaleTimeString()}]`, message, ...args);
}
}
}
}
warn(message: string | Error, ...args: any[]): void {
if (this.level <= LogLevel.Warning) {
if (this.useColors) {
console.warn(`\x1b[93m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, message, ...args);
} else {
console.warn(`[main ${new Date().toLocaleTimeString()}]`, message, ...args);
}
}
}
error(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Error) {
if (this.useColors) {
console.error(`\x1b[91m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, message, ...args);
} else {
console.error(`[main ${new Date().toLocaleTimeString()}]`, message, ...args);
}
}
}
critical(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Critical) {
if (this.useColors) {
console.error(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, message, ...args);
} else {
console.error(`[main ${new Date().toLocaleTimeString()}]`, message, ...args);
}
}
}
dispose(): void {
// noop
}
}
export class ConsoleLogService implements ILogService {
_serviceBrand: any;
private level: LogLevel = LogLevel.Error;
constructor( @IEnvironmentService environmentService: IEnvironmentService) {
this.setLevel(environmentService.logLevel);
}
setLevel(level: LogLevel): void {
this.level = level;
}
getLevel(): LogLevel {
return this.level;
}
trace(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Trace) {
console.log('%cTRACE', 'color: #888', message, ...args);
}
}
debug(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Debug) {
console.log('%cDEBUG', 'background: #eee; color: #888', message, ...args);
}
}
info(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Info) {
console.log('%c INFO', 'color: #33f', message, ...args);
}
}
warn(message: string | Error, ...args: any[]): void {
if (this.level <= LogLevel.Warning) {
console.log('%c WARN', 'color: #993', message, ...args);
}
}
error(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Error) {
console.log('%c ERR', 'color: #f33', message, ...args);
}
}
critical(message: string, ...args: any[]): void {
if (this.level <= LogLevel.Critical) {
console.log('%cCRITI', 'background: #f33; color: white', message, ...args);
}
}
dispose(): void { }
}
export class MultiplexLogService implements ILogService {
_serviceBrand: any;
constructor(private logServices: ILogService[]) { }
setLevel(level: LogLevel): void {
for (const logService of this.logServices) {
logService.setLevel(level);
}
}
getLevel(): LogLevel {
for (const logService of this.logServices) {
return logService.getLevel();
}
return LogLevel.Info;
}
trace(message: string, ...args: any[]): void {
for (const logService of this.logServices) {
logService.trace(message, ...args);
}
}
debug(message: string, ...args: any[]): void {
for (const logService of this.logServices) {
logService.debug(message, ...args);
}
}
info(message: string, ...args: any[]): void {
for (const logService of this.logServices) {
logService.info(message, ...args);
}
}
warn(message: string, ...args: any[]): void {
for (const logService of this.logServices) {
logService.warn(message, ...args);
}
}
error(message: string | Error, ...args: any[]): void {
for (const logService of this.logServices) {
logService.error(message, ...args);
}
}
critical(message: string | Error, ...args: any[]): void {
for (const logService of this.logServices) {
logService.critical(message, ...args);
}
}
dispose(): void {
for (const logService of this.logServices) {
logService.dispose();
}
}
}
export class NoopLogService implements ILogService {
_serviceBrand: any;
setLevel(level: LogLevel): void { }
getLevel(): LogLevel { return LogLevel.Info; }
trace(message: string, ...args: any[]): void { }
debug(message: string, ...args: any[]): void { }
info(message: string, ...args: any[]): void { }
warn(message: string, ...args: any[]): void { }
error(message: string | Error, ...args: any[]): void { }
critical(message: string | Error, ...args: any[]): void { }
dispose(): void { }
}