Beautify output when its an object, indent multiline output
This commit is contained in:
parent
14f825cb51
commit
0822e06f17
@ -32,6 +32,12 @@ const out = (data, color = CWhite) => {
|
||||
if (!Array.isArray(data)) data = [data];
|
||||
process.stdout.write(color);
|
||||
process.stdout.write(getTime() + " ");
|
||||
|
||||
if (typeof data[0] === 'object') {
|
||||
data[0] = JSON.stringify(data[0], null, 2);
|
||||
}
|
||||
data[0] = data[0].replace(/\n/g, '\n | ');
|
||||
|
||||
console.log.apply(console, data);
|
||||
process.stdout.write(CWhite);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user