From 93bff3757982cc505a87addc610816ed54982f84 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Mon, 26 May 2008 09:24:17 +0000 Subject: Applied patch to enable logging from Javascript view functions. Closes COUCHDB-59. Thanks to Chris Anderson for the patch. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@660140 13f79535-47bb-0310-9956-ffa450edef68 --- THANKS | 1 + share/server/main.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/THANKS b/THANKS index 27d4e5e5..e05741f0 100644 --- a/THANKS +++ b/THANKS @@ -6,6 +6,7 @@ and a number of other contributors. Many people further contributed to Apache CouchDB by reporting problems, suggesting various improvements or submitting changes. A list of these people is included below. + * Chris Anderson * William Beh * Benoit Chesneau * Till Klampaeckel diff --git a/share/server/main.js b/share/server/main.js index a62ed1ff..7fe08608 100644 --- a/share/server/main.js +++ b/share/server/main.js @@ -28,11 +28,16 @@ sum = function(values) { return rv; } +log = function(message) { + print(toJSON({log: toJSON(message)})); +} + try { // if possible, use evalcx (not always available) sandbox = evalcx(''); sandbox.emit = emit; sandbox.sum = sum; + sandbox.log = log; } catch (e) {} // Commands are in the form of json arrays: -- cgit v1.2.3