Skip to content
This repository
Browse code

Merge pull request #34 from gjohnson/master

clarify usage
  • Loading branch information...
commit 73936c4ddf85212190132ed61b6aa137aaf177aa 2 parents 78106cc + 5114094
TJ Holowaychuk authored

Showing 1 changed file with 3 additions and 18 deletions. Show diff stats Hide diff stats

  1. +3 18 Readme.md
21 Readme.md
Source Rendered
... ... @@ -1,7 +1,7 @@
1 1
2 2 # debug
3 3
4   - tiny node.js debugging utility.
  4 + tiny node.js debugging utility modelled after node core's debugging technique.
5 5
6 6 ## Installation
7 7
@@ -9,24 +9,9 @@
9 9 $ npm install debug
10 10 ```
11 11
12   -## Example
  12 +## Usage
13 13
14   - This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules:
15   -
16   -```js
17   -var debug;
18   -if (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {
19   - debug = function(x) {
20   - var prefix = process.pid + ',' +
21   - (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');
22   - console.error(prefix, x);
23   - };
24   -} else {
25   - debug = function() { };
26   -}
27   -```
28   -
29   - This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
  14 + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
30 15
31 16 Example _app.js_:
32 17

0 comments on commit 73936c4

Please sign in to comment.
Something went wrong with that request. Please try again.