Skip to content

Commit 6ff529b

Browse files
committed
change existing uses
1 parent 5c7724a commit 6ff529b

File tree

12 files changed

+33
-38
lines changed

12 files changed

+33
-38
lines changed

packages/core/src/applicationcomposer/messageHandlers/generateResourceHandler.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ async function generateResource(cfnType: string) {
8686
// TODO-STARLING - Revisit to see if timeout still needed prior to launch
8787
const data = await timeout(amazonqApi.chatApi.chat(request), TIMEOUT)
8888
const initialResponseTime = globals.clock.Date.now() - startTime
89-
getLogger().debug(`CW Chat initial response: ${JSON.stringify(data, undefined, 2)}, ${initialResponseTime} ms`)
89+
getLogger().debug(`CW Chat initial response: %O, ${initialResponseTime} ms`, data)
9090
if (data['$metadata']) {
9191
metadata = data['$metadata']
9292
}
9393

9494
if (data.generateAssistantResponseResponse === undefined) {
95-
getLogger().debug(`Error: Unexpected model response: ${JSON.stringify(data, undefined, 2)}`)
95+
getLogger().debug(`Error: Unexpected model response: %O`, data)
9696
throw new Error('No model response')
9797
}
9898

@@ -141,12 +141,15 @@ async function generateResource(cfnType: string) {
141141
`CW Chat Debug message:
142142
cfnType = "${cfnType}",
143143
conversationId = ${conversationId},
144-
metadata = \n${JSON.stringify(metadata, undefined, 2)},
145-
supplementaryWebLinks = \n${JSON.stringify(supplementaryWebLinks, undefined, 2)},
146-
references = \n${JSON.stringify(references, undefined, 2)},
144+
metadata = %O,
145+
supplementaryWebLinks = %O,
146+
references = %O,
147147
response = "${response}",
148148
initialResponse = ${initialResponseTime} ms,
149-
elapsed time = ${elapsedTime} ms`
149+
elapsed time = ${elapsedTime} ms`,
150+
metadata,
151+
supplementaryWebLinks,
152+
references
150153
)
151154

152155
return {
@@ -163,7 +166,7 @@ async function generateResource(cfnType: string) {
163166
getLogger().debug(`CW Chat error: ${error.name} - ${error.message}`)
164167
if (error.$metadata) {
165168
const { requestId, cfId, extendedRequestId } = error.$metadata
166-
getLogger().debug(JSON.stringify({ requestId, cfId, extendedRequestId }, undefined, 2))
169+
getLogger().debug('%O', { requestId, cfId, extendedRequestId })
167170
}
168171

169172
throw error

packages/core/src/codewhisperer/service/recommendationHandler.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,7 @@ export class RecommendationHandler {
220220
* Validate request
221221
*/
222222
if (!EditorContext.validateRequest(request)) {
223-
getLogger().verbose(
224-
'Invalid Request : ',
225-
JSON.stringify(request, undefined, EditorContext.getTabSize())
226-
)
223+
getLogger().verbose('Invalid Request: %O', request)
227224
const languageName = request.fileContext.programmingLanguage.languageName
228225
if (!runtimeLanguageContext.isLanguageSupported(languageName)) {
229226
errorMessage = `${languageName} is currently not supported by Amazon Q inline suggestions`

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,7 @@ export class ChatController {
651651

652652
const request = triggerPayloadToChatRequest(triggerPayload)
653653
const session = this.sessionStorage.getSession(tabID)
654-
getLogger().info(
655-
`request from tab: ${tabID} conversationID: ${session.sessionIdentifier} request: ${JSON.stringify(
656-
request
657-
)}`
658-
)
654+
getLogger().info(`request from tab: ${tabID} conversationID: ${session.sessionIdentifier} request: %O`, request)
659655
let response: GenerateAssistantResponseCommandOutput | undefined = undefined
660656
session.createNewTokenSource()
661657
try {
@@ -668,7 +664,8 @@ export class ChatController {
668664
getLogger().info(
669665
`response to tab: ${tabID} conversationID: ${session.sessionIdentifier} requestID: ${
670666
response.$metadata.requestId
671-
} metadata: ${JSON.stringify(response.$metadata)}`
667+
} metadata: %O`,
668+
response.$metadata
672669
)
673670
await this.messenger.sendAIResponse(response, session, tabID, triggerID, triggerPayload)
674671
} catch (e: any) {

packages/core/src/shared/crashMonitoring.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class CrashChecker {
297297
// Example is if I hit the red square in the debug menu, it is a non-graceful shutdown. But the regular
298298
// 'x' button in the Debug IDE instance is a graceful shutdown.
299299
if (ext.isDebug) {
300-
devLogger?.debug(`crashMonitoring: DEBUG instance crashed: ${JSON.stringify(ext)}`)
300+
devLogger?.debug(`crashMonitoring: DEBUG instance crashed: %O`, ext)
301301
return
302302
}
303303

@@ -318,7 +318,10 @@ class CrashChecker {
318318
// Sanity check: ENSURE THAT AFTER === ACTUAL or this implies that our data is out of sync
319319
const afterActual = (await state.getAllExts()).map((i) => truncateUuid(i.sessionId))
320320
devLogger?.debug(
321-
`crashMonitoring: CHECKED: Result of cleaning up crashed instances\nBEFORE: ${JSON.stringify(before)}\nAFTER: ${JSON.stringify(after)}\nACTUAL: ${JSON.stringify(afterActual)}`
321+
`crashMonitoring: CHECKED: Result of cleaning up crashed instances\nBEFORE: %O \nAFTER: %O \nACTUAL: %O`,
322+
before,
323+
after,
324+
afterActual
322325
)
323326
}
324327

packages/core/src/shared/featureConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class FeatureConfigProvider {
110110
})
111111
})
112112
})
113-
getLogger().info('AB Testing Cohort Assignments %s', JSON.stringify(response.featureEvaluations))
113+
getLogger().info('AB Testing Cohort Assignments %O', response.featureEvaluations)
114114

115115
const customizationArnOverride = this.featureConfigs.get(Features.customizationArnOverride)?.value
116116
?.stringValue

packages/core/src/shared/sam/debugger/awsSamDebugger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export class SamDebugConfigProvider implements vscode.DebugConfigurationProvider
308308
}
309309
}
310310
}
311-
getLogger().verbose(`provideDebugConfigurations: debugconfigs: ${JSON.stringify(configs)}`)
311+
getLogger().verbose(`provideDebugConfigurations: debugconfigs: %O`, configs)
312312
}
313313

314314
return configs
@@ -445,7 +445,7 @@ export class SamDebugConfigProvider implements vscode.DebugConfigurationProvider
445445
} else if (rv.message) {
446446
void vscode.window.showInformationMessage(rv.message)
447447
}
448-
getLogger().verbose(`SAM debug: config: ${JSON.stringify(config.name)}`)
448+
getLogger().verbose(`SAM debug: config %s:`, config.name)
449449
}
450450

451451
const editor = vscode.window.activeTextEditor

packages/core/src/shared/sam/debugger/pythonSamDebug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function makePythonDebugManifest(params: {
4949
if (await fileExists(manfestPath)) {
5050
manifestText = await readFileAsString(manfestPath)
5151
}
52-
getLogger().debug(`pythonCodeLensProvider.makePythonDebugManifest params: ${JSON.stringify(params, undefined, 2)}`)
52+
getLogger().debug(`pythonCodeLensProvider.makePythonDebugManifest params: %O`, params)
5353
// TODO: If another module name includes the string "ikp3db", this will be skipped...
5454
// HACK: Cloud9-created Lambdas hardcode ikp3db 1.1.4, which only functions with Python 3.6 (which we don't support)
5555
// Remove any ikp3db dependency if it exists and manually add a non-pinned ikp3db dependency.

packages/core/src/shared/sam/localLambdaRunner.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,16 +452,11 @@ export async function attachDebugger({
452452
},
453453
...params
454454
}: AttachDebuggerContext): Promise<void> {
455-
getLogger().debug(
456-
`localLambdaRunner.attachDebugger: startDebugging with config: ${JSON.stringify(
457-
{
458-
name: params.debugConfig.name,
459-
invokeTarget: params.debugConfig.invokeTarget,
460-
},
461-
undefined,
462-
2
463-
)}`
464-
)
455+
const obj = {
456+
name: params.debugConfig.name,
457+
invokeTarget: params.debugConfig.invokeTarget,
458+
}
459+
getLogger().debug(`localLambdaRunner.attachDebugger: startDebugging with config: %O`, obj)
465460

466461
getLogger().info(localize('AWS.output.sam.local.attaching', 'Attaching debugger to SAM application...'))
467462

packages/core/src/shared/telemetry/telemetryService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ export function filterTelemetryCacheEvents(input: any): MetricDatum[] {
470470
!Object.prototype.hasOwnProperty.call(item, 'EpochTimestamp') ||
471471
!Object.prototype.hasOwnProperty.call(item, 'Unit')
472472
) {
473-
getLogger().warn(`skipping invalid item in telemetry cache: ${JSON.stringify(item)}\n`)
473+
getLogger().warn(`skipping invalid item in telemetry cache: %O\n`, item)
474474

475475
return false
476476
}

packages/core/src/shared/utilities/map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export abstract class NestedMap<Key, Value = { [key: string]: any }> implements
4343
delete(key: Key, reason?: string): void {
4444
delete this.data[this.hash(key)]
4545
if (reason) {
46-
getLogger().debug(`${this.name}: cleared cache, key: ${JSON.stringify(key)}, reason: ${reason}`)
46+
getLogger().debug(`${this.name}: cleared cache, key: %O, reason: ${reason}`, key)
4747
}
4848
}
4949

0 commit comments

Comments
 (0)