From 09aba4cf1654f28fde977c13c3796b8e059d1703 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 2 Jan 2024 08:52:51 +0100 Subject: [PATCH] chore(backend/logger): log data for every level if exists (#12863) --- packages/backend/src/logger.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/logger.ts b/packages/backend/src/logger.ts index 5c10559ec6..0a19036c97 100644 --- a/packages/backend/src/logger.ts +++ b/packages/backend/src/logger.ts @@ -71,8 +71,11 @@ export default class Logger { let log = `${l} ${worker}\t[${contexts.join(' ')}]\t${m}`; if (envOption.withLogTime) log = chalk.gray(time) + ' ' + log; - console.log(important ? chalk.bold(log) : log); - if (level === 'error' && data) console.log(data); + const args: unknown[] = [important ? chalk.bold(log) : log]; + if (data != null) { + args.push(data); + } + console.log(...args); } @bindThis