Skip to content

Commit a527f96

Browse files
committed
feat(beta): improve beta URL logging
1 parent ad78245 commit a527f96

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/core/src/dev/beta.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ import { CancellationError } from '../shared/utilities/timeoutUtils'
2121
import { isAmazonQ, isCloud9, productName } from '../shared/extensionUtilities'
2222
import * as config from './config'
2323
import { isReleaseVersion } from '../shared/vscode/env'
24+
import { getRelativeDate } from '../shared/datetime'
2425

2526
const localize = nls.loadMessageBundle()
27+
const logger = getLogger('dev/beta')
2628

2729
const downloadIntervalMs = 1000 * 60 * 60 * 24 // A day in milliseconds
2830

@@ -57,12 +59,13 @@ export async function activate(ctx: vscode.ExtensionContext) {
5759
* If this is the first time we are watching the beta version or if its been 24 hours since it was last checked then try to prompt for update
5860
*/
5961
export function watchBetaVSIX(vsixUrl: string): vscode.Disposable {
60-
getLogger().info(`dev: watching ${vsixUrl} for beta artifacts`)
61-
6262
const toolkit = getBetaToolkitData(vsixUrl)
63+
const lastCheckRel = toolkit ? getRelativeDate(new Date(toolkit.lastCheck)) : ''
64+
logger.info('watching beta artifacts url (lastCheck: %s): %s', lastCheckRel, vsixUrl)
65+
6366
if (!toolkit || toolkit.needUpdate || Date.now() - toolkit.lastCheck > downloadIntervalMs) {
6467
runAutoUpdate(vsixUrl).catch((e) => {
65-
getLogger().error('runAutoUpdate failed: %s', (e as Error).message)
68+
logger.error('runAutoUpdate failed: %s', (e as Error).message)
6669
})
6770
}
6871

@@ -71,13 +74,13 @@ export function watchBetaVSIX(vsixUrl: string): vscode.Disposable {
7174
}
7275

7376
async function runAutoUpdate(vsixUrl: string) {
74-
getLogger().debug(`dev: checking ${vsixUrl} for a new version`)
77+
logger.debug(`checking url for a new version: %s`, vsixUrl)
7578

7679
try {
7780
await telemetry.aws_autoUpdateBeta.run(() => checkBetaUrl(vsixUrl))
7881
} catch (e) {
7982
if (!isUserCancelledError(e)) {
80-
getLogger().warn(`dev: beta extension auto-update failed: %s`, e)
83+
logger.warn('beta extension auto-update failed: %s', e)
8184
}
8285
}
8386
}
@@ -165,7 +168,7 @@ async function promptInstallToolkit(pluginPath: vscode.Uri, newVersion: string,
165168
switch (response) {
166169
case installBtn:
167170
try {
168-
getLogger().info(`dev: installing artifact ${vsixName}`)
171+
logger.info(`installing artifact: ${vsixName}`)
169172
await vscode.commands.executeCommand('workbench.extensions.installExtension', pluginPath)
170173
await updateBetaToolkitData(vsixUrl, {
171174
lastCheck: Date.now(),

0 commit comments

Comments
 (0)