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

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() { module.exports = (function() {
var Query = function(client, callee, options) { var Query = function(client, callee, options) {
...@@ -7,10 +7,20 @@ module.exports = (function() { ...@@ -7,10 +7,20 @@ module.exports = (function() {
this.client = client this.client = client
this.callee = callee this.callee = callee
this.options = Utils._.extend({ this.options = Utils._.extend({
logging: true, logging: console.log,
plain: false, plain: false,
raw: false raw: false
}, options || {}) }, 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) Utils._.extend(Query.prototype, require("../query").prototype)
...@@ -19,6 +29,10 @@ module.exports = (function() { ...@@ -19,6 +29,10 @@ module.exports = (function() {
this.sql = sql this.sql = sql
if(this.options.logging !== false) {
this.options.logging('Executing: ' + this.sql)
}
var results = []; var results = [];
var receivedError = false; var receivedError = false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!