2

In my project sequelize logging is disabled, but I want active logging in the exact query.

How can I do that?

TableModel.update(
    {counter: 0},
    {where: {
        id: itm.i
    }},
    ).then((res) =>{
        console.log('res',res);
    }).catch(e => {
        console.log('update error : ', e);
    });

I know how I can do it in findall query like this:

TableModel.findAll({where: {...}, logging: console.log})

but in the update, I can't find any solution.

sequelize version: 5.21

Sarvesh Mahajan
  • 914
  • 7
  • 16
ttrasn
  • 4,322
  • 4
  • 26
  • 43

1 Answers1

3

I found solution.

that was so easy just adding logging:true in options.

TableModel.update(
    {counter: 0},
    {
        where: {
            id: itm.i
        },
        logging:true
    }
    ).then((res) =>{
        console.log('res',res);
    }).catch(e => {
        console.log('update error : ', e);
    });
ttrasn
  • 4,322
  • 4
  • 26
  • 43