Fix #64273 - EH log levels start at 1

This commit is contained in:
Rob Lourens
2018-12-05 13:29:15 -08:00
parent 8f7bd57cde
commit 514217add5
3 changed files with 15 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
import { localize } from 'vs/nls';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import * as errors from 'vs/base/common/errors';
import { Emitter } from 'vs/base/common/event';
import { Emitter, mapEvent } from 'vs/base/common/event';
import { TernarySearchTree } from 'vs/base/common/map';
import * as paths from 'vs/base/common/paths';
import * as platform from 'vs/base/common/platform';
@@ -246,11 +246,11 @@ export function createApiFactory(
get appRoot() { return initData.environment.appRoot.fsPath; },
get logLevel() {
checkProposedApiEnabled(extension);
return extHostLogService.getLevel();
return typeConverters.LogLevel.fromMainLogLevel(extHostLogService.getLevel());
},
get onDidChangeLogLevel() {
checkProposedApiEnabled(extension);
return extHostLogService.onDidChangeLogLevel;
return mapEvent(extHostLogService.onDidChangeLogLevel, l => typeConverters.LogLevel.fromMainLogLevel(l));
},
get clipboard(): vscode.Clipboard {
return extHostClipboard;

View File

@@ -4,8 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { join } from 'vs/base/common/paths';
import { LogLevel } from 'vs/workbench/api/node/extHostTypes';
import { ILogService, DelegatedLogService } from 'vs/platform/log/common/log';
import { ILogService, DelegatedLogService, LogLevel } from 'vs/platform/log/common/log';
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
import { ExtHostLogServiceShape } from 'vs/workbench/api/node/extHost.protocol';
import { ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions';

View File

@@ -27,6 +27,7 @@ import { isString, isNumber } from 'vs/base/common/types';
import * as marked from 'vs/base/common/marked/marked';
import { parse } from 'vs/base/common/marshalling';
import { cloneAndChange } from 'vs/base/common/objects';
import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log';
export interface PositionLike {
line: number;
@@ -967,3 +968,13 @@ export namespace LanguageSelector {
}
}
}
export namespace LogLevel {
export function fromMainLogLevel(mainLevel: _MainLogLevel): types.LogLevel {
return mainLevel + 1;
}
export function toMainLogLevel(extLevel: types.LogLevel): _MainLogLevel {
return extLevel - 1;
}
}