Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -6,68 +6,61 @@
'use strict';
import * as path from 'path';
import { ILogService, LogLevel, NoopLogService } from 'vs/platform/log/common/log';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ILogService, LogLevel, NullLogService, AbstractLogService } from 'vs/platform/log/common/log';
import { RotatingLogger, setAsyncMode } from 'spdlog';
export function createLogService(processName: string, environmentService: IEnvironmentService): ILogService {
export function createSpdLogService(processName: string, logLevel: LogLevel, logsFolder: string): ILogService {
try {
setAsyncMode(8192, 2000);
const logfilePath = path.join(environmentService.logsPath, `${processName}.log`);
const logfilePath = path.join(logsFolder, `${processName}.log`);
const logger = new RotatingLogger(processName, logfilePath, 1024 * 1024 * 5, 6);
logger.setLevel(0);
return new SpdLogService(logger, environmentService.logLevel);
return new SpdLogService(logger, logLevel);
} catch (e) {
console.error(e);
}
return new NoopLogService();
return new NullLogService();
}
class SpdLogService implements ILogService {
class SpdLogService extends AbstractLogService implements ILogService {
_serviceBrand: any;
constructor(
private readonly logger: RotatingLogger,
private level: LogLevel = LogLevel.Error
level: LogLevel = LogLevel.Error
) {
}
setLevel(logLevel: LogLevel): void {
this.level = logLevel;
}
getLevel(): LogLevel {
return this.level;
super();
this.setLevel(level);
}
trace(): void {
if (this.level <= LogLevel.Trace) {
if (this.getLevel() <= LogLevel.Trace) {
this.logger.trace(this.format(arguments));
}
}
debug(): void {
if (this.level <= LogLevel.Debug) {
if (this.getLevel() <= LogLevel.Debug) {
this.logger.debug(this.format(arguments));
}
}
info(): void {
if (this.level <= LogLevel.Info) {
if (this.getLevel() <= LogLevel.Info) {
this.logger.info(this.format(arguments));
}
}
warn(): void {
if (this.level <= LogLevel.Warning) {
if (this.getLevel() <= LogLevel.Warning) {
this.logger.warn(this.format(arguments));
}
}
error(): void {
if (this.level <= LogLevel.Error) {
if (this.getLevel() <= LogLevel.Error) {
const arg = arguments[0];
if (arg instanceof Error) {
@@ -81,13 +74,12 @@ class SpdLogService implements ILogService {
}
critical(): void {
if (this.level <= LogLevel.Critical) {
if (this.getLevel() <= LogLevel.Critical) {
this.logger.critical(this.format(arguments));
}
}
dispose(): void {
this.logger.flush();
this.logger.drop();
}