Skip to content

Commit 62df220

Browse files
TooTallNatethebigredgeek
authored andcommitted
Deprecate DEBUG_FD (#405)
* remove DEBUG_FD from readme * deprecate DEBUG_FD * remove arrow function ES6 habbits hit hard :D
1 parent 9a18d66 commit 62df220

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ Then, run the program to be debugged as usual.
9999
|-----------|-------------------------------------------------|
100100
| `DEBUG` | Enables/disabled specific debugging namespaces. |
101101
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
102-
| `DEBUG_FD`| File descriptor to output debug logs to. Defaults to stderr. |
103102
| `DEBUG_DEPTH` | Object inspection depth. |
104103
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
105104

@@ -110,8 +109,6 @@ Then, run the program to be debugged as usual.
110109
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
111110
for the complete list.
112111

113-
__Note:__ Certain IDEs (such as WebStorm) don't support colors on stderr. In these cases you must set `DEBUG_COLORS` to `1` and additionally change `DEBUG_FD` to `1`.
114-
115112
## Formatters
116113

117114

@@ -181,13 +178,10 @@ setInterval(function(){
181178

182179
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
183180

184-
## Output streams
185-
186181

187-
### stderr vs stdout
188-
By default `debug` will log to stderr, however this can be changed by setting the environment variable `DEBUG_FD` to `1` for stdout and `2` for stderr (the default value).
182+
## Output streams
189183

190-
You can also set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
184+
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
191185

192186
Example _stdout.js_:
193187

@@ -211,15 +205,6 @@ error('now goes to stdout via console.info');
211205
log('still goes to stdout, but via console.info now');
212206
```
213207

214-
### Save debug output to a file
215-
216-
You can save all debug statements to a file by piping them.
217-
218-
Example:
219-
220-
```bash
221-
$ DEBUG_FD=3 node your-app.js 3> whatever.log
222-
```
223208

224209
## Authors
225210

src/node.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) {
5858
* $ DEBUG_FD=3 node script.js 3>debug.log
5959
*/
6060

61+
if ('DEBUG_FD' in process.env) {
62+
util.deprecate(function(){}, '`DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/vMUyr)')()
63+
}
64+
6165
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
6266
var stream = 1 === fd ? process.stdout :
6367
2 === fd ? process.stderr :

0 commit comments

Comments
 (0)