couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [2/5] git commit: Working console and util modules
Date Mon, 11 Feb 2013 03:29:11 GMT
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/946fe33f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/946fe33f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/946fe33f

Branch: refs/heads/1676-feature-console_log
Commit: 946fe33f900e4785fac5679c5c41539bf12b7c43
Parents: 1b2aae7
Author: Jason Smith (work) <jhs@iriscouch.com>
Authored: Fri Feb 1 13:59:20 2013 +0000
Committer: Jason Smith (work) <jhs@iriscouch.com>
Committed: Mon Feb 11 01:57:37 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/946fe33f/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 <jhs@apache.org>
+
+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/946fe33f/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 <jhs@apache.org>
+
+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;
+})();


Mime
View raw message