You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<imgwidth="647"alt="screen shot 2017-08-08 at 12 53 04 pm"src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
61
+
<imgwidth="647"alt="screen shot 2017-08-08 at 12 53 38 pm"src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
62
+
<imgwidth="647"alt="screen shot 2017-08-08 at 12 53 25 pm"src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
59
63
60
64
#### Windows note
61
65
62
-
On Windows the environment variable is set using the `set` command.
66
+
On Windows the environment variable is set using the `set` command.
63
67
64
-
```cmd
65
-
set DEBUG=*,-not_this
66
-
```
68
+
```cmd
69
+
set DEBUG=*,-not_this
70
+
```
67
71
68
-
Note that PowerShell uses different syntax to set environment variables.
72
+
Note that PowerShell uses different syntax to set environment variables.
69
73
70
-
```cmd
71
-
$env:DEBUG = "*,-not_this"
72
-
```
74
+
```cmd
75
+
$env:DEBUG = "*,-not_this"
76
+
```
73
77
74
78
Then, run the program to be debugged as usual.
75
79
76
80
## Millisecond diff
77
81
78
-
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
82
+
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
93
+
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
89
94
90
95
## Wildcards
91
96
92
-
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
97
+
The `*` character may be used as a wildcard. Suppose for example your library has
98
+
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
99
+
instead of listing all three with
100
+
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
101
+
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
93
102
94
-
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
103
+
You can also exclude specific debuggers by prefixing them with a "-" character.
104
+
For example, `DEBUG=*,-connect:*` would include all debuggers except those
105
+
starting with "connect:".
95
106
96
107
## Environment Variables
97
108
98
-
When running through Node.js, you can set a few environment variables that will
99
-
change the behavior of the debug logging:
109
+
When running through Node.js, you can set a few environment variables that will
@@ -126,9 +137,12 @@ Then, run the program to be debugged as usual.
126
137
|`%j`| JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
127
138
|`%%`| Single percent sign ('%'). This does not consume an argument. |
128
139
140
+
129
141
### Custom formatters
130
142
131
-
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
143
+
You can add custom formatters by extending the `debug.formatters` object.
144
+
For example, if you wanted to add support for rendering a Buffer as hex with
145
+
`%h`, you could do something like:
132
146
133
147
```js
134
148
constcreateDebug=require('debug')
@@ -142,14 +156,16 @@ debug('this is hex: %h', new Buffer('hello world'))
142
156
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
143
157
```
144
158
145
-
## Browser support
146
-
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
147
-
or just use the [browserify-as-a-service](https://wzrd.in/)[build](https://wzrd.in/standalone/debug@latest),
148
-
if you don't want to build it yourself.
149
159
150
-
Debug's enable state is currently persisted by `localStorage`.
151
-
Consider the situation shown below where you have `worker:a` and `worker:b`,
152
-
and wish to debug both. You can enable this using `localStorage.debug`:
160
+
## Browser Support
161
+
162
+
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
163
+
or just use the [browserify-as-a-service](https://wzrd.in/)[build](https://wzrd.in/standalone/debug@latest),
164
+
if you don't want to build it yourself.
165
+
166
+
Debug's enable state is currently persisted by `localStorage`.
167
+
Consider the situation shown below where you have `worker:a` and `worker:b`,
168
+
and wish to debug both. You can enable this using `localStorage.debug`:
153
169
154
170
```js
155
171
localStorage.debug='worker:*'
@@ -172,21 +188,21 @@ setInterval(function(){
172
188
173
189
#### Web Inspector Colors
174
190
175
-
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
176
-
option. These are WebKit web inspectors, Firefox ([since version
0 commit comments