How can I make Mongoose debug output look pretty in console? Currently the output is displayed on one line.
Here is something I put together, maybe somebody will find it useful.
Install colors module for node.js (this is optional):
npm install colors
Then in your file:
var colors = require('colors');
mongoose.set('debug', function (collectionName, method, query, doc) {
console.log(
'Mongoose: '.cyan +
collectionName +
'.' +
method +
' (' +
JSON.stringify(query, null, 2) + ')');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With