0.1.0 • Published 5 years ago

egg-sequelize-slow v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

egg-sequelize-slow

Install

$ npm i egg-sequelize-slow --save

Usage

// {app_root}/config/plugin.js
exports.sequelizeSlow = {
  enable: true,
  package: 'egg-sequelize-slow'
};

Configuration

// {app_root}/config/config.default.js
exports.sequelizeSlow = {
  logging: null // default
};

see config/config.default.js for more detail.

Example

It will print SQL that the runtime is more than 1s to the terminal.

config.sequelizeSlow = {
    logging: (ctx, sql, time, opts) => {
      if (time > 1000) {
        console.log(`# slow SQL: runtime:${time} =>`)
        console.log(sql)
        console.log(`# end`)
      }
    }
  }

Questions & Suggestions

Please open an issue here.

License

MIT