Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ILogService, LogLevel, AbstractLogService } from 'vs/platform/log/common/log';
interface ILog {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { createDecorator as createServiceDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { isWindows } from 'vs/base/common/platform';

View File

@@ -3,20 +3,11 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { TPromise } from 'vs/base/common/winjs.base';
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
import { LogLevel, ILogService, DelegatedLogService } from 'vs/platform/log/common/log';
import { Event, buffer } from 'vs/base/common/event';
export interface ILogLevelSetterChannel extends IChannel {
listen(event: 'onDidChangeLogLevel'): Event<LogLevel>;
listen<T>(event: string, arg?: any): Event<T>;
call(command: 'setLevel', logLevel: LogLevel): TPromise<void>;
call(command: string, arg?: any): TPromise<any>;
}
export class LogLevelSetterChannel implements ILogLevelSetterChannel {
export class LogLevelSetterChannel implements IServerChannel {
onDidChangeLogLevel: Event<LogLevel>;
@@ -24,32 +15,33 @@ export class LogLevelSetterChannel implements ILogLevelSetterChannel {
this.onDidChangeLogLevel = buffer(service.onDidChangeLogLevel, true);
}
listen<T>(event: string): Event<any> {
listen(_, event: string): Event<any> {
switch (event) {
case 'onDidChangeLogLevel': return this.onDidChangeLogLevel;
}
throw new Error('No event found');
throw new Error(`Event not found: ${event}`);
}
call(command: string, arg?: any): TPromise<any> {
call(_, command: string, arg?: any): Thenable<any> {
switch (command) {
case 'setLevel': this.service.setLevel(arg); return TPromise.as(null);
case 'setLevel': this.service.setLevel(arg);
}
return undefined;
throw new Error(`Call not found: ${command}`);
}
}
export class LogLevelSetterChannelClient {
constructor(private channel: ILogLevelSetterChannel) { }
constructor(private channel: IChannel) { }
get onDidChangeLogLevel(): Event<LogLevel> {
return this.channel.listen('onDidChangeLogLevel');
}
setLevel(level: LogLevel): TPromise<void> {
return this.channel.call('setLevel', level);
setLevel(level: LogLevel): void {
this.channel.call('setLevel', level);
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as path from 'path';
import { ILogService, LogLevel, NullLogService, AbstractLogService } from 'vs/platform/log/common/log';
import * as spdlog from 'spdlog';
@@ -13,7 +11,7 @@ export function createSpdLogService(processName: string, logLevel: LogLevel, log
// Do not crash if spdlog cannot be loaded
try {
const _spdlog: typeof spdlog = require.__$__nodeRequire('spdlog');
_spdlog.setAsyncMode(8192, 2000);
_spdlog.setAsyncMode(8192, 500);
const logfilePath = path.join(logsFolder, `${processName}.log`);
const logger = new _spdlog.RotatingLogger(processName, logfilePath, 1024 * 1024 * 5, 6);
logger.setLevel(0);
@@ -25,6 +23,11 @@ export function createSpdLogService(processName: string, logLevel: LogLevel, log
return new NullLogService();
}
export function createRotatingLogger(name: string, filename: string, filesize: number, filecount: number): spdlog.RotatingLogger {
const _spdlog: typeof spdlog = require.__$__nodeRequire('spdlog');
return new _spdlog.RotatingLogger(name, filename, filesize, filecount);
}
class SpdLogService extends AbstractLogService implements ILogService {
_serviceBrand: any;