Merge pull request #5129 from node-red/fix-up-colors

Only apply colours for non-default log lines
This commit is contained in:
Nick O'Leary
2025-05-02 09:28:13 +01:00
committed by GitHub

View File

@@ -52,11 +52,11 @@ var levelColours = {
10: 'red',
20: 'red',
30: 'yellow',
40: 'white',
40: '',
50: 'cyan',
60: 'gray',
98: 'white',
99: 'white'
98: '',
99: ''
};
var logHandlers = [];
@@ -99,7 +99,12 @@ const utilLog = function (msg, level) {
d.getMinutes().toString().padStart(2, '0'),
d.getSeconds().toString().padStart(2, '0')
].join(':');
console.log(chalk[levelColours[level] || 'white'](`${d.getDate()} ${months[d.getMonth()]} ${time} - ${msg}`))
const logLine = `${d.getDate()} ${months[d.getMonth()]} ${time} - ${msg}`
if (levelColours[level]) {
console.log(chalk[levelColours[level]](logLine))
} else {
console.log(logLine)
}
}
var consoleLogger = function(msg) {