chore(backend/logger): log data for every level if exists

This commit is contained in:
Kagami Sascha Rosylight 2023-12-30 23:54:50 +01:00
parent 30594dde18
commit 90040ab8b3
1 changed files with 5 additions and 2 deletions

View File

@ -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