From f301c9cef116a971eb390b1aede2d9b194ce469e Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 12:29:29 +0100 Subject: [PATCH] fix createDebugLogger --- yarn-project/foundation/src/log/logger.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index d008774f182e..f179f7c26354 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -49,13 +49,13 @@ export function createDebugLogger(name: string, taggedLogData?: LogData ): Debug const logger = { silent: () => {}, - error: (...args: any[]) => logWithDebug(debugLogger, 'error', {...args, ...taggedLogData}), - warn: (...args: any[]) => logWithDebug(debugLogger, 'warn', {...args, ...taggedLogData}), - info: (...args: any[]) => logWithDebug(debugLogger, 'info', {...args, ...taggedLogData}), - verbose: (...args: any[]) => logWithDebug(debugLogger, 'verbose', {...args, ...taggedLogData}), - debug: (...args: any[]) => logWithDebug(debugLogger, 'debug', {...args, ...taggedLogData}), + error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), data), + warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, {...data,...taggedLogData}), + info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, {...data,...taggedLogData} ), + verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, {...data,...taggedLogData}), + debug: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, {...data,...taggedLogData}), }; - return Object.assign((...args: any[]) => logWithDebug(debugLogger, 'debug', {...args, ...taggedLogData}), logger); + return Object.assign((msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, {...data,...taggedLogData}), logger) } /** A callback to capture all logs. */ export type LogHandler = (level: LogLevel, namespace: string, msg: string, data?: LogData) => void;