Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add query-logger #334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add query-logger #334

wants to merge 1 commit into from

Conversation

keke001009
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant