From 213518648b3a79f575d2a0dca34aa1c21f277383 Mon Sep 17 00:00:00 2001 From: brianc Date: Thu, 7 Mar 2013 10:01:14 -0600 Subject: [PATCH] ability to hide deprecation warnings --- lib/client.js | 6 ++++-- lib/defaults.js | 9 +++++++++ lib/pool.js | 3 ++- lib/types/textParsers.js | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/client.js b/lib/client.js index cc9e2b8..75c5035 100644 --- a/lib/client.js +++ b/lib/client.js @@ -262,7 +262,8 @@ Client.prototype.pauseDrain = function() { 'please see the following for more details:', 'https://github.com/brianc/node-postgres/wiki/pg', 'https://github.com/brianc/node-postgres/issues/227', - 'https://github.com/brianc/node-postgres/pull/274'); + 'https://github.com/brianc/node-postgres/pull/274', + 'feel free to get in touch via github if you have questions'); this._drainPaused = 1; }; @@ -272,7 +273,8 @@ Client.prototype.resumeDrain = function() { 'please see the following for more details:', 'https://github.com/brianc/node-postgres/wiki/pg', 'https://github.com/brianc/node-postgres/issues/227', - 'https://github.com/brianc/node-postgres/pull/274'); + 'https://github.com/brianc/node-postgres/pull/274', + 'feel free to get in touch via github if you have questions'); if(this._drainPaused > 1) { this.emit('drain'); } diff --git a/lib/defaults.js b/lib/defaults.js index 738908e..9f3cbb9 100644 --- a/lib/defaults.js +++ b/lib/defaults.js @@ -33,3 +33,12 @@ module.exports = { //pool log function / boolean poolLog: false }; + +var deprecate = require('deprecate'); +//getter/setter to disable deprecation warnings +module.exports.__defineGetter__("hideDeprecationWarnings", function() { + return deprecate.silent; +}); +module.exports.__defineSetter__("hideDeprecationWarnings", function(val) { + deprecate.silence = val; +}); diff --git a/lib/pool.js b/lib/pool.js index ce31473..cd53820 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -85,7 +85,8 @@ var oldConnect = function(pool, client, cb) { 'please see the following for more details:', 'https://github.com/brianc/node-postgres/wiki/pg', 'https://github.com/brianc/node-postgres/issues/227', - 'https://github.com/brianc/node-postgres/pull/274'); + 'https://github.com/brianc/node-postgres/pull/274', + 'feel free to get in touch via github if you have questions'); var tid = setTimeout(function() { console.error(errorMessage); }, alarmDuration); diff --git a/lib/types/textParsers.js b/lib/types/textParsers.js index 00ceecb..77d2a48 100644 --- a/lib/types/textParsers.js +++ b/lib/types/textParsers.js @@ -83,7 +83,8 @@ var parseFloatArray = function(val) { 'unexpected, hard to trace, potentially bad bugs in your program', 'for more information see the following:', 'https://github.com/brianc/node-postgres/pull/271', - 'in node-postgres v1.0.0 all floats & decimals will be returned as strings'); + 'in node-postgres v1.0.0 all floats & decimals will be returned as strings', + 'feel free to get in touch via a github issue if you have any questions'); if(!val) { return null; } var p = arrayParser.create(val, function(entry){ if(entry !== null) {