]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/read-installed/node_modules/debuglog/README.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / read-installed / node_modules / debuglog / README.md
1 # debuglog - backport of util.debuglog() from node v0.11
2
3 To facilitate using the `util.debuglog()` function that will be available when
4 node v0.12 is released now, this is a copy extracted from the source.
5
6 ## require('debuglog')
7
8 Return `util.debuglog`, if it exists, otherwise it will return an internal copy
9 of the implementation from node v0.11.
10
11 ## debuglog(section)
12
13 * `section` {String} The section of the program to be debugged
14 * Returns: {Function} The logging function
15
16 This is used to create a function which conditionally writes to stderr
17 based on the existence of a `NODE_DEBUG` environment variable.  If the
18 `section` name appears in that environment variable, then the returned
19 function will be similar to `console.error()`.  If not, then the
20 returned function is a no-op.
21
22 For example:
23
24 ```javascript
25 var debuglog = util.debuglog('foo');
26
27 var bar = 123;
28 debuglog('hello from foo [%d]', bar);
29 ```
30
31 If this program is run with `NODE_DEBUG=foo` in the environment, then
32 it will output something like:
33
34     FOO 3245: hello from foo [123]
35
36 where `3245` is the process id.  If it is not run with that
37 environment variable set, then it will not print anything.
38
39 You may separate multiple `NODE_DEBUG` environment variables with a
40 comma.  For example, `NODE_DEBUG=fs,net,tls`.