以前、Sequelizeを使ってPostgresqlに接続する方法を調べた
これを引き続き利用していたが、使用しているとログに実行したsqlが出力されていることに気付いたので止めたい
ドキュメントによるとインスタンスをつくるときのoption.logging
で設定できるみたい
const sequelize = new Sequelize('sqlite::memory:', { // Choose one of the logging options logging: console.log, // Default, displays the first parameter of the log function call logging: (...msg) => console.log(msg), // Displays all log function call parameters logging: false, // Disables logging logging: msg => logger.debug(msg), // Use custom logger (e.g. Winston or Bunyan), displays the first parameter logging: logger.debug.bind(logger) // Alternative way to use custom logger, displays all messages });
デフォルトはlogging: console.log
になっているので、これをlogging: false
にすれば出力されなくなることがわかった