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
obug picks up enabled namespaces from the `DEBUG` environment variable in Node.js, or from `localStorage.debug` in browsers.
80
+
81
+
In Node.js:
82
+
83
+
```bash
84
+
DEBUG=app:* node app.js
85
+
```
86
+
87
+
On Windows (CMD):
88
+
89
+
```cmd
90
+
set DEBUG=app:* & node app.js
91
+
```
92
+
93
+
On Windows (PowerShell):
94
+
95
+
```powershell
96
+
$env:DEBUG='app:*'; node app.js
97
+
```
98
+
99
+
In the browser, set the value in DevTools and refresh the page:
100
+
101
+
```js
102
+
localStorage.debug='app:*'
103
+
```
104
+
105
+
### Wildcards and exclusion
106
+
107
+
The `*` character is a wildcard. Suppose your library has debuggers named `connect:bodyParser`, `connect:compress`, and `connect:session` — instead of listing each one, use `DEBUG=connect:*`. Use `DEBUG=*` to enable everything.
108
+
109
+
Exclude namespaces by prefixing them with `-`:
110
+
111
+
```bash
112
+
DEBUG=*,-connect:* node app.js
113
+
```
114
+
115
+
### Namespace conventions
116
+
117
+
If you're using obug in a library, prefix your namespaces with the library name and use `:` to separate features (e.g. `connect:bodyParser`). This lets users opt into the parts they care about without guessing names.
118
+
119
+
### Extending a namespace
120
+
121
+
Use `.extend()` to create a sub-namespace that inherits options from its parent:
|`DEBUG`| Enables/disables specific debugging namespaces. |
210
+
|`DEBUG_HIDE_DATE`| Hide date from debug output (non-TTY). |
211
+
|`DEBUG_COLORS`| Whether to use colors in the debug output. |
212
+
|`DEBUG_DEPTH`| Object inspection depth. |
213
+
|`DEBUG_SHOW_HIDDEN`| Shows hidden properties on inspected objects. |
214
+
215
+
Variables prefixed with `DEBUG_` are converted to camelCase keys on the options object passed to Node's [`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) for the `%o` / `%O` formatters.
216
+
75
217
## Original Authors
76
218
77
219
As obug is a fork of debug with significant modifications, we would like to acknowledge the original authors:
0 commit comments