From 825f6a8439f18358e198894a86153d4c5424e9cd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 14 Nov 2024 11:30:20 -0800 Subject: [PATCH] fix(logger): logs show "%s" instead of replaced value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Log messages have literal format strings such as "%s", even though values were passed to the log function: 2024-11-14 11:00:33.778 [info] CloudFormationTemplateRegistry: processed … %s 2024-11-14 11:00:34.634 [debug] schema service: handle … -> %s Solution: Regression introduced by `TopicLogger`. Fix the call. --- packages/core/src/shared/logger/logger.ts | 2 +- packages/core/src/test/testLogger.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/shared/logger/logger.ts b/packages/core/src/shared/logger/logger.ts index 9d7d18458b6..bfead668bc9 100644 --- a/packages/core/src/shared/logger/logger.ts +++ b/packages/core/src/shared/logger/logger.ts @@ -248,7 +248,7 @@ export class TopicLogger extends BaseLogger implements vscode.Disposable { if (typeof message === 'string') { message = prependTopic(this.topic, message) as string } - return this.logger.sendToLog(level, message, meta) + return this.logger.sendToLog(level, message, ...meta) } public async dispose(): Promise {} diff --git a/packages/core/src/test/testLogger.ts b/packages/core/src/test/testLogger.ts index 514e3115eda..6414b4bab99 100644 --- a/packages/core/src/test/testLogger.ts +++ b/packages/core/src/test/testLogger.ts @@ -51,7 +51,7 @@ export class TestLogger implements Logger { .map((loggedEntry) => loggedEntry.entry) } - public sendToLog(logLevel: LogLevel, msg: string, entries: Loggable[]): number { + public sendToLog(logLevel: LogLevel, msg: string, ...entries: Loggable[]): number { return this.addLoggedEntries(logLevel, [msg, ...entries]) }