Skip to content

Commit a500e16

Browse files
author
Kartik Raj
authored
Only log deprecation warning once for each extension (#19901)
For #19900
1 parent a4f08a8 commit a500e16

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/client/deprecatedProposedApi.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ export function buildDeprecatedProposedApi(
6363
const interpreterPathService = serviceContainer.get<IInterpreterPathService>(IInterpreterPathService);
6464
const interpreterService = serviceContainer.get<IInterpreterService>(IInterpreterService);
6565
const extensions = serviceContainer.get<IExtensions>(IExtensions);
66+
const warningLogged = new Set<string>();
6667
function sendApiTelemetry(apiName: string, warnLog = true) {
67-
if (warnLog) {
68-
console.warn('Extension is using deprecated python APIs which will be removed soon');
69-
}
7068
extensions
7169
.determineExtensionFromCallStack()
7270
.then((info) => {
@@ -75,6 +73,12 @@ export function buildDeprecatedProposedApi(
7573
extensionId: info.extensionId,
7674
});
7775
traceVerbose(`Extension ${info.extensionId} accessed ${apiName}`);
76+
if (warnLog && !warningLogged.has(info.extensionId)) {
77+
console.warn(
78+
`${info.extensionId} extension is using deprecated python APIs which will be removed soon.`,
79+
);
80+
warningLogged.add(info.extensionId);
81+
}
7882
})
7983
.ignoreErrors();
8084
}

0 commit comments

Comments
 (0)