aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.52k stars 443 forks source link

test(logger): test logger does not format objects as expected #6083

Closed Hweinstock closed 4 hours ago

Hweinstock commented 1 day ago

Problem

The test logger does not format additional arguements into the logs in the same way as ToolkitLogger. Ex. getLogger().debug('here is the obj: %O', obj) will produce two LogEntries one with "here is the obj: %O" and one with the object itself.

This is problematic because it causes confusion (see: https://github.com/aws/aws-toolkit-vscode/pull/5895#discussion_r1832979093) and it also can cause assertLogsContain to throw an error since there is now a non-string/error entry in the log entry list (see: https://github.com/aws/aws-toolkit-vscode/blob/338ea67f2ba0294fc535a9a949fd1cdaeaa96d98/packages/core/src/test/globalSetup.test.ts#L171-L185).

Solution


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.