under nodejs you can try util.inspect(obj, {depth:10, colors:true ...})
i used it under mocha tested to indent logs
const log = (...args:unknown[])=>{
setTimeout(()=>{
let indent = "\t";
args = args.map(a=>util.inspect(a, {colors:true, depth:10}).replace(/^\x1B\[32m['"`]/ig, '\x1B[32m').replace(/['"`]\x1B\[39m$/ig, '\x1B[39m').replace(/\n/g, `\n${indent} `))
console.log.call(console, indent, ...args);
})
}
let user = {
name:"surinder singh",
age:38,
hobbies:[{
name:"Something interesting",
from:"birth"
},{
name:"Electronic DIY",
from:"from ~primary"
},{
name:"Coding",
from:"after school"
}]
}
let args = ["a string 1234", 123 , {xyz:"xyz", num:123, arr:["xxx", 123, {345:"xxx"}, user], bool:true}];
console.log( ...args );
log( ...args )
