Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

clarify usage #34

Merged
merged 1 commit into from

2 participants

@gjohnson

Drops the node-core example that you see right away, it confuses people (who don't read the whole documentation lol) into thinking the NODE_DEBUG env variable should be used to trigger the output.

@tj tj merged commit 73936c4 into visionmedia:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 5, 2013
  1. clarify usage in readme

    Garrett Johnson authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 18 deletions.
  1. +3 −18 Readme.md
View
21 Readme.md
@@ -1,7 +1,7 @@
# debug
- tiny node.js debugging utility.
+ tiny node.js debugging utility modelled after node core's debugging technique.
## Installation
@@ -9,24 +9,9 @@
$ npm install debug
```
-## Example
+## Usage
- 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:
-
-```js
-var debug;
-if (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {
- debug = function(x) {
- var prefix = process.pid + ',' +
- (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');
- console.error(prefix, x);
- };
-} else {
- debug = function() { };
-}
-```
-
- 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.
+ 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.
Example _app.js_:
Something went wrong with that request. Please try again.