PUT /files/util/mongoose_logger.js HTTP/1.1
Host: 127.0.0.1
Accept-Encoding: identity
Content-Length: 512
Content-MD5: HnOa1PBNXCEsCpiJtycqIQ==
Expect: 100-continue
Date: Thu, 08 Dec 2016 13:02:39 GMT
User-Agent: aws-cli/1.11.26 Python/2.7.10 Darwin/16.1.0 botocore/1.4.83
Content-Type: application/javascript
Authorization: AWS 123:Mr5jFNNDPwV0x/wQnhvqjl2uvl0=

'use strict';

var util = require('util');

module.exports = make_logger;

var MONGOOSE_INSPECT_OPT = {
    depth: 5
};

function make_logger(logger) {
    return function(collectionName, method, query, doc, options) {
        logger('\x1B[0;36mMongoose:\x1B[0m %s.%s(%s) %s %s %s',
        collectionName,
        method,
        util.inspect(query, MONGOOSE_INSPECT_OPT),
        doc ? util.inspect(doc, MONGOOSE_INSPECT_OPT) : '',
        options ? util.inspect(options, MONGOOSE_INSPECT_OPT) : '');
    };
}
