add db logging

This commit is contained in:
jejolare 2026-03-14 15:20:49 +07:00
parent 985eddd3f1
commit 4c2a01e5cb

View file

@ -8,12 +8,11 @@ const sequelize = new Sequelize({
port: parseInt(process.env.PGPORT || '5432', 10),
database: process.env.PGDATABASE,
benchmark: true,
// logging: (sql, timingMs) => {
// if (typeof timingMs === 'number' && timingMs > 1000) {
// console.warn(`[slow sql] ${timingMs}ms`, sql);
// }
// },
logging: false,
logging: (sql, timingMs) => {
if (typeof timingMs === 'number' && timingMs > 1000) {
console.warn(`[slow sql] ${timingMs}ms`, sql);
}
},
pool: {
max: 80,
min: 0,