Skip to content

Commit d3102da

Browse files
committed
add more logging
1 parent d52e416 commit d3102da

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

packages/core/src/shared/sam/cli/samCliLocalInvoke.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import * as proc from 'child_process'
77
import { pushIf } from '../../utilities/collectionUtils'
88
import * as nls from 'vscode-nls'
9-
import { fileExists } from '../../filesystemUtilities'
109
import { getLogger, getDebugConsoleLogger, Logger } from '../../logger'
1110
import { ChildProcess } from '../../utilities/processUtils'
1211
import { Timeout } from '../../utilities/timeoutUtils'
@@ -15,6 +14,7 @@ import * as vscode from 'vscode'
1514
import globals from '../../extensionGlobals'
1615
import { SamCliSettings } from './samCliSettings'
1716
import { addTelemetryEnvVar, collectSamErrors, SamCliError } from './samCliInvokerUtils'
17+
import { fs } from '../..'
1818

1919
const localize = nls.loadMessageBundle()
2020

@@ -236,6 +236,8 @@ export class SamCliLocalInvokeInvocation {
236236
const sam = await this.config.getOrDetectSamCli()
237237
// eslint-disable-next-line aws-toolkits/no-console-log
238238
console.log('getOrDetect took %O seconds', (Date.now() - start) / 1000)
239+
// eslint-disable-next-line aws-toolkits/no-console-log
240+
console.log('autodetect is %O', sam.autoDetected)
239241
if (!sam.path) {
240242
getLogger().warn('SAM CLI not found and not configured')
241243
} else if (sam.autoDetected) {
@@ -290,11 +292,11 @@ export class SamCliLocalInvokeInvocation {
290292
throw new Error('template resource name is missing or empty')
291293
}
292294

293-
if (!(await fileExists(this.args.templatePath))) {
295+
if (!(await fs.exists(this.args.templatePath))) {
294296
throw new Error(`template path does not exist: ${this.args.templatePath}`)
295297
}
296298

297-
if (this.args.eventPath !== undefined && !(await fileExists(this.args.eventPath))) {
299+
if (this.args.eventPath !== undefined && !(await fs.exists(this.args.eventPath))) {
298300
throw new Error(`event path does not exist: ${this.args.eventPath}`)
299301
}
300302
}

packages/core/src/shared/sam/cli/samCliLocator.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export class SamCliLocationProvider {
2929
public async getLocation(forceSearch?: boolean): Promise<{ path: string; version: string } | undefined> {
3030
const perflog = new PerfLog('samCliLocator: getLocation')
3131
const cachedLoc = forceSearch ? undefined : SamCliLocationProvider.cachedSamLocation
32+
// eslint-disable-next-line aws-toolkits/no-console-log
33+
console.log('cachedLoc is: %O', cachedLoc)
3234

3335
// Avoid searching the system for `sam` (especially slow on Windows).
3436
if (cachedLoc && (await SamCliLocationProvider.isValidSamLocation(cachedLoc.path))) {

packages/core/src/shared/sam/cli/samCliSettings.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ export class SamCliSettings extends fromExtensionManifest('aws.samcli', descript
8383
SamCliSettings.logIfChanged(`SAM CLI location (from settings): ${fromConfig}`)
8484
return { path: fromConfig, autoDetected: false }
8585
}
86-
86+
const start = Date.now()
8787
const fromSearch = await this.locationProvider.getLocation(forceSearch)
88+
// eslint-disable-next-line aws-toolkits/no-console-log
89+
console.log('getOrDetect took %O seconds', (Date.now() - start) / 1000)
90+
8891
SamCliSettings.logIfChanged(`SAM CLI location (version: ${fromSearch?.version}): ${fromSearch?.path}`)
8992
return { path: fromSearch?.path, autoDetected: true }
9093
}

0 commit comments

Comments
 (0)