DEBUG_DEPTH env var has no effect. I tried values of 10, 100, null. No matter what I always get the following display:
2020-02-08T22:17:01.423Z SCOPE STRING [ { email: '[email protected]', vars: [ [Object] ] } ]
My invocation:
debug('STRING', targetObj);
Noticed this also. Looks like it is defaulting to 3 and not allowing an override...
Any fix in the works?
Yep looks like a regression somewhere.
Can you test with npm i --no-save visionmedia/debug#fix/depth?
Started down the git blame rabbit hole. If that branch fixes it, then this has been broken for years. Amazing.
Looks like fix is effective. Any place to add unit tests for this?
I should have noted it reproduces only when deep object is the _second_ argument to the debug function, e.g.
// index.js
require('debug')('FOO')('something', {
x: 1,
y: { a: 2, b: 3, c: { a: 1, b: { a: 1, b: { a: 1, b: { a: 1 } } } } },
});
Before fix:
$ DEBUG=FOO DEBUG_DEPTH=40 node index.js
FOO something { x: 1, y: { a: 2, b: 3, c: { a: 1, b: [Object] } } } +0ms
After fix:
$ DEBUG=FOO DEBUG_DEPTH=40 node index.js
FOO something {
x: 1,
y: {
a: 2,
b: 3,
c: {
a: 1,
b: { a: 1, b: { a: 1, b: { a: 1 } } }
}
}
} +0ms
I should have noted it reproduces only when deep object is the second argument to the debug function, e.g.
Yeah that's much less simple to fix; there are a few bugs surrounding this. v5 is going to be a rewrite for the most part, so a lot of this will get addressed then.
Glad to know it works now (mostly); I'll commit it in sometime soon. Thank you very much for testing @anishkny :)
Most helpful comment
Yeah that's much less simple to fix; there are a few bugs surrounding this. v5 is going to be a rewrite for the most part, so a lot of this will get addressed then.
Glad to know it works now (mostly); I'll commit it in sometime soon. Thank you very much for testing @anishkny :)