enhance(backend): loggerでデータの表示にutil.inspectを使用する

This commit is contained in:
tamaina
2024-03-04 11:32:08 +00:00
parent 13f5fafdbc
commit f7e8862d28
2 changed files with 18 additions and 12 deletions

View File

@@ -4,6 +4,7 @@
*/
import cluster from 'node:cluster';
import { inspect } from 'node:util';
import chalk from 'chalk';
import { default as convertColor } from 'color-convert';
import { format as dateFormat } from 'date-fns';
@@ -73,7 +74,16 @@ export default class Logger {
const args: unknown[] = [important ? chalk.bold(log) : log];
if (data != null) {
args.push(data);
args.push(inspect(data, {
depth: Infinity,
compact: true,
breakLength: Infinity,
colors: true,
showHidden: false,
showProxy: false,
maxArrayLength: Infinity,
maxStringLength: Infinity,
}));
}
console.log(...args);
}