chalk/chalk

Cannot color objects

skeddles opened this issue · 1 comments

I was hoping to use this for logging, I frequently log out objects to see their values.

Normally console.log(myObject) will log out the entire contents of the object.

But if you wrap it in chalk, it just gets turned into [object Object]

console.log(chalk.blue({a: 123123, b:234234234, c:3245345}));

It would be nice if chalk worked like console.log and stringified the objects before printing them, so we dont have to stringify them manually every time:

console.log(chalk.blue(JSON.stringify({a: 123123, b:234234234, c:3245345})));

There are no plans to add this. It's the job for a higher-level package, like a logging library. You could also use util.inspect.