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

Commit fe4eef85 by Sascha Depold

Use the custom logging function if defined

1 parent 624e89f9
Showing with 17 additions and 1 deletions
...@@ -519,7 +519,11 @@ module.exports = (function() { ...@@ -519,7 +519,11 @@ module.exports = (function() {
args = [].slice.call(arguments) args = [].slice.call(arguments)
} }
this.logger.log.apply(this.logger, args) if ((typeof this.options.logging === 'function') && (this.options.logging != console.log)) {
this.options.logging.apply(null, args.slice(1))
} else {
this.logger.log.apply(this.logger, args)
}
} }
} }
......
...@@ -69,5 +69,17 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () { ...@@ -69,5 +69,17 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
}) })
}) })
}) })
describe("with a custom function for logging", function() {
beforeEach(function() {
this.spy = sinon.spy()
this.sequelize = new Support.Sequelize('db', 'user', 'pw', { logging: this.spy })
})
it("calls the custom logger method", function() {
this.sequelize.log('om nom')
expect(this.spy.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!