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

Commit fe4eef85 by Sascha Depold

Use the custom logging function if defined

1 parent 624e89f9
Showing with 16 additions and 0 deletions
......@@ -519,9 +519,13 @@ module.exports = (function() {
args = [].slice.call(arguments)
}
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)
}
}
}
return Sequelize
})()
......@@ -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!