dispose the telemetry reporter (#446)

This commit is contained in:
Sheng Chen 2018-09-27 15:47:03 +08:00 committed by GitHub
parent 71a1f7bed4
commit 3691e8392b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -44,6 +44,7 @@ function initializeExtension(operationId: string, context: vscode.ExtensionConte
});
});
context.subscriptions.push(logger);
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider("java", new JavaDebugConfigurationProvider()));
context.subscriptions.push(instrumentAndRegisterCommand("JavaDebug.SpecifyProgramArgs", async () => {
return specifyProgramArguments(context);

View File

@ -11,7 +11,7 @@ export enum Type {
ACTIVATEEXTENSION = "activateExtension", // TODO: Activation belongs to usage data, remove this category.
}
class Logger {
class Logger implements vscode.Disposable {
private reporter: TelemetryReporter = null;
public initialize(context: vscode.ExtensionContext): void {
@ -43,6 +43,12 @@ class Logger {
public logMessage(type: Type, message: string): void {
this.log(type, { message });
}
public dispose() {
if (this.reporter) {
this.reporter.dispose();
}
}
}
export const logger = new Logger();