Closed Hweinstock closed 4 hours ago
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.
getLogger().debug('here is the obj: %O', obj)
LogEntries
"here is the obj: %O"
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).
assertLogsContain
BaseLogger
testLogger
util.format
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
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 twoLogEntries
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
BaseLogger
to minimize implementation dupe.testLogger
.util.format
: https://github.com/nodejs/node/blob/3178a762d6a2b1a37b74f02266eea0f3d86603be/lib/internal/util/inspect.js#L2191-L2315License: I confirm that my contribution is made under the terms of the Apache 2.0 license.