Add ExtHostLogService with logger and lazily created log folder per extension

This commit is contained in:
Rob Lourens
2017-12-12 19:07:41 -08:00
parent 4d42f3d7af
commit daa3a0ec2e
8 changed files with 156 additions and 7 deletions

View File

@@ -59,6 +59,8 @@ import { toGlobPattern, toLanguageSelector } from 'vs/workbench/api/node/extHost
import { ExtensionActivatedByAPI } from 'vs/workbench/api/node/extHostExtensionActivator';
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
export interface IExtensionApiFactory {
(extension: IExtensionDescription): typeof vscode;
@@ -83,7 +85,8 @@ export function createApiFactory(
extHostWorkspace: ExtHostWorkspace,
extHostConfiguration: ExtHostConfiguration,
extensionService: ExtHostExtensionService,
logService: ILogService
logService: ILogService,
environmentService: IEnvironmentService
): IExtensionApiFactory {
// Addressable instances
@@ -121,6 +124,7 @@ export function createApiFactory(
const extHostProgress = new ExtHostProgress(threadService.get(MainContext.MainThreadProgress));
const extHostOutputService = new ExtHostOutputService(threadService);
const extHostLanguages = new ExtHostLanguages(threadService);
const extHostLogService = new ExtHostLogService(environmentService);
// Register API-ish commands
ExtHostApiCommands.register(extHostCommands);
@@ -202,6 +206,7 @@ export function createApiFactory(
get language() { return Platform.language; },
get appName() { return product.nameLong; },
get appRoot() { return initData.environment.appRoot; },
get logger() { return extHostLogService.getExtLogger(extension.id); },
});
// namespace: extensions
@@ -570,6 +575,7 @@ export function createApiFactory(
Hover: extHostTypes.Hover,
IndentAction: languageConfiguration.IndentAction,
Location: extHostTypes.Location,
LogLevel: extHostTypes.LogLevel,
MarkdownString: extHostTypes.MarkdownString,
OverviewRulerLane: EditorCommon.OverviewRulerLane,
ParameterInformation: extHostTypes.ParameterInformation,