Only apply colours for non-default log lines

pull/5129/head
Nick O'Leary 2025-05-01 17:55:50 +01:00
parent 8c4a6d5a83
commit 03d324eae8
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 9 additions and 4 deletions

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) {