summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Smith (work) <jhs@iriscouch.com>2013-02-11 03:10:16 +0000
committerJason Smith (work) <jhs@iriscouch.com>2013-02-11 03:10:16 +0000
commitec8d2c8630e17f1e1a2d537fb70950f370009789 (patch)
tree05d8c402d60976d27c0d51570eb72f431f7a2d0c
parente45c689d9f256190e88b860fa2f689249204d5ad (diff)
downloadcouchdb-1676-feature-console_log.tar.gz
Document the new logging and formatting API1676-feature-console_log
-rw-r--r--share/doc/src/query-servers.rst31
1 files changed, 31 insertions, 0 deletions
diff --git a/share/doc/src/query-servers.rst b/share/doc/src/query-servers.rst
index e77abd7b6..860e16728 100644
--- a/share/doc/src/query-servers.rst
+++ b/share/doc/src/query-servers.rst
@@ -132,6 +132,37 @@ modules and functions:
[Sat, 03 Nov 2012 17:38:02 GMT] [info] [<0.7543.0>] OS Process #Port<0.3289> Log :: Processing doc 8d300b86622d67953d102165dbe99467
+.. function:: util.format(format, [...])
+
+ :param format: A printf-like format string, compatible with Node.js.
+ :return: The formatted string
+
+ .. code-block:: javascript
+
+ function(doc){
+ var key = util.format("%s%s", doc.prefix, doc.suffix);
+ emit(key, null);
+ }
+
+.. function:: console.log(format, [...])
+
+ :param format: A printf-like format string, compatible with Node.js.
+
+ .. code-block:: javascript
+
+ function(doc){
+ console.log('Processing doc %s rev %j', doc._id, doc._rev);
+ emit(doc['_id'], null);
+ }
+
+ On map function run in CouchDB logs (e.g. at `/var/log/couchdb/couch.log`)
+ you may find next record:
+
+ .. code-block:: text
+
+ [Sat, 03 Nov 2012 17:38:02 GMT] [info] [<0.7543.0>] OS Process #Port<0.3289> Log :: Processing doc 8d300b86622d67953d102165dbe99467 rev "269-fda3ccf153724273fe458cf72ce2bcf8"
+
+
.. function:: provides(key, func)
Registers callable handler for specified MIME key.