不要怂,就是干,撸起袖子干!

Commit aa7360aa by contactakagrawal Committed by Jan Aagaard Meier

slice the options argument if the logging is set to console.log (#7555)

* slice the options argument if the logging is set to console.log

* added test case to check if the options object is available for custom logging function, this test case has been added for the pull request 'slice the options argument if the logging is set to console.log (#7555)'
1 parent c48964a6
...@@ -1023,8 +1023,10 @@ class Sequelize { ...@@ -1023,8 +1023,10 @@ class Sequelize {
if (last && Utils._.isPlainObject(last) && last.hasOwnProperty('logging')) { if (last && Utils._.isPlainObject(last) && last.hasOwnProperty('logging')) {
options = last; options = last;
// remove options from set of logged arguments // remove options from set of logged arguments if options.logging is equal to console.log
args.splice(args.length-1, 1); if(options.logging === console.log){
args.splice(args.length-1, 1);
}
} else { } else {
options = this.options; options = this.options;
} }
......
...@@ -69,6 +69,15 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => { ...@@ -69,6 +69,15 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
this.sequelize.log('om nom'); this.sequelize.log('om nom');
expect(this.spy.calledOnce).to.be.true; expect(this.spy.calledOnce).to.be.true;
}); });
it('calls the custom logger method with options', function() {
const message = 'om nom';
const timeTaken = 5;
const options = {correlationId: 'ABC001'};
this.sequelize.log(message, timeTaken, options);
expect(this.spy.withArgs(message, timeTaken, options).calledOnce).to.be.true;
});
}); });
}); });
}); });
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!