From eb73f5065b6b319541a4e7bd0f7df0003caf4b6b Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Sun, 31 Dec 2023 20:03:45 +0800 Subject: [PATCH] fix: should add paddingMessage on ConsoleLogger (#93) --- lib/utils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 81d7d99..8b0abaa 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -72,7 +72,12 @@ module.exports = { // output to Terminal format consoleFormatter(meta) { - let msg = meta.date + ' ' + meta.level + ' ' + meta.pid + ' ' + meta.message; + let paddingMessage = ' '; + // try to use the exists paddingMessage first + if (meta.paddingMessage) { + paddingMessage = ` ${meta.paddingMessage} `; + } + let msg = meta.date + ' ' + meta.level + ' ' + meta.pid + paddingMessage + meta.message; if (!chalk.supportsColor) { return msg; }