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

Commit b0e3dc8d by Raúl Acuña Committed by sdepold

Add logging to postgres dialect

1 parent 77d80a9d
Showing with 16 additions and 2 deletions
var Utils = require("../../utils")
var Utils = require("../../utils");
module.exports = (function() {
var Query = function(client, callee, options) {
......@@ -7,10 +7,20 @@ module.exports = (function() {
this.client = client
this.callee = callee
this.options = Utils._.extend({
logging: true,
logging: console.log,
plain: false,
raw: false
}, options || {})
if(this.options.logging === true) {
console.log('DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log')
this.options.logging = console.log
}
if(this.options.logging == console.log) {
// using just console.log will break in node < 0.6
this.options.logging = function(s) { console.log(s) }
}
}
Utils._.extend(Query.prototype, require("../query").prototype)
......@@ -19,6 +29,10 @@ module.exports = (function() {
this.sql = sql
if(this.options.logging !== false) {
this.options.logging('Executing: ' + this.sql)
}
var results = [];
var receivedError = false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!