Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8885FEFCF for ; Fri, 1 Feb 2013 14:03:15 +0000 (UTC) Received: (qmail 44014 invoked by uid 500); 1 Feb 2013 14:03:14 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 43705 invoked by uid 500); 1 Feb 2013 14:03:14 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 43252 invoked by uid 99); 1 Feb 2013 14:03:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 14:03:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D944E828DE2; Fri, 1 Feb 2013 14:03:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jhs@apache.org To: commits@couchdb.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [2/3] git commit: Working console and util modules Message-Id: <20130201140312.D944E828DE2@tyr.zones.apache.org> Date: Fri, 1 Feb 2013 14:03:12 +0000 (UTC) Working console and util modules Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/242f6e28 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/242f6e28 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/242f6e28 Branch: refs/heads/console_log Commit: 242f6e28a16e51d3cf50eea86c69d945a10e9c8a Parents: fc87318 Author: Jason Smith (work) Authored: Fri Feb 1 13:59:20 2013 +0000 Committer: Jason Smith (work) Committed: Fri Feb 1 13:59:20 2013 +0000 ---------------------------------------------------------------------- share/server/console.js | 21 +++++++++++++++++---- share/server/nodejs_util.js | 12 ++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/242f6e28/share/server/console.js ---------------------------------------------------------------------- diff --git a/share/server/console.js b/share/server/console.js index 64d21a4..8516cda 100644 --- a/share/server/console.js +++ b/share/server/console.js @@ -19,10 +19,19 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -var util = require('util'); +// Changes for CouchDB by Jason Smith + +var Console = (function() { + var exports = {}; + var module = {'exports':exports}; + var util = Util; + var assert = {'ok':function(a, b) { if(!a) throw new Error(b) }}; + // -- CommonJS wrapper + +//var util = require('util'); exports.log = function() { - process.stdout.write(util.format.apply(this, arguments) + '\n'); + log(util.format.apply(this, arguments)); }; @@ -30,7 +39,7 @@ exports.info = exports.log; exports.warn = function() { - process.stderr.write(util.format.apply(this, arguments) + '\n'); + log(util.format.apply(this, arguments)); }; @@ -38,7 +47,7 @@ exports.error = exports.warn; exports.dir = function(object) { - process.stdout.write(util.inspect(object) + '\n'); + log(util.inspect(object)); }; @@ -75,3 +84,7 @@ exports.assert = function(expression) { require('assert').ok(false, util.format.apply(this, arr)); } }; + + // -- CommonJS wrapper + return exports; +})(); http://git-wip-us.apache.org/repos/asf/couchdb/blob/242f6e28/share/server/nodejs_util.js ---------------------------------------------------------------------- diff --git a/share/server/nodejs_util.js b/share/server/nodejs_util.js index 53775e7..c19512f 100644 --- a/share/server/nodejs_util.js +++ b/share/server/nodejs_util.js @@ -19,6 +19,14 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +// Changes for CouchDB by Jason Smith + +var Util = (function() { + var process = {}; + var exports = {}; + var module = {'exports':exports}; + // -- CommonJS wrapper + var formatRegExp = /%[sdj%]/g; exports.format = function(f) { if (typeof f !== 'string') { @@ -556,3 +564,7 @@ exports._extend = function(origin, add) { } return origin; }; + + // -- CommonJS wrapper + return exports; +})();