From e914905bde5c0372b3a279a7ee960a3da3bb6c83 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Sun, 31 Dec 2023 19:56:27 +0800 Subject: [PATCH] fix: should add paddingMessage on ConsoleLogger --- 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; }