egg-mongoose-logger
v1.0.6
Published
A helper plugin to hook egg logger library in mongoose.
Downloads
3
Readme
egg-mongoose-logger
Install
$ npm i egg-mongoose-logger --save
Usage
// {app_root}/config/plugin.js
exports.mongooseLogger = {
enable: true,
package: 'egg-mongoose-logger',
};
Configuration
// {app_root}/config/config.default.js
exports.mongooseLogger = {
debug: true,
// custom formatter, optional
formatter: function(meta) {
const query = JSON.stringify(meta.query);
const options = JSON.stringify(meta.options || {});
return `db.getCollection('${meta.collectionName}').${meta.methodName}(${query}, ${options})`;
},
};
see config/config.default.js for more detail.
Example
Questions & Suggestions
Please open an issue here.