denodb icon indicating copy to clipboard operation
denodb copied to clipboard

Add query-logger

Open keke001009 opened this issue 4 years ago • 0 comments

I have created a queryLogger option to the database for mysql, postgreSQL and sqlite.

sequelize logging options

example

database

  const connection: Database = new Database(
    { dialect: "mysql" },
    {
      ...options,
      queryLogger : (query : string, execTime : number)=>{
        console.log(`[${execTime} ms] ${query}`)
      }
    },
  );

code

const result = await Flight.where({ departure: "Paris" }).first();

expected

[9 ms] select * from `flights` where `departure` = 'Paris' limit 1

keke001009 avatar Feb 27 '22 00:02 keke001009