debug
debug copied to clipboard
DEBUG_DEPTH not working
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 :)
What is the status on this issue ?
I noticed it recently in our production container, but that's a bit more tricky since I can't reproduce the problem locally.
Same value of DEBUG_DEPTH
in both case (10
).
Trying to decrement or increment it locally seems to produce the expected effect, while any value in our container does nothing (looks like it's stucked to 3
), so I'm guessing something else is interfering but I wasn't able to find out what yet.
What is the status on this issue?
@Qix- very useful & constructive, thanks.
Since you clearly need me to clarify my question:
Giving this issue is opened for more than a year, and no news since Jul 9, 2020, would you be so kind to provide some update on its resolution ?
Thanks
There is no update.
@Qix- Thanks.
Thing is, you apparently already had a fix a year ago and stated in the last update on this issue :
[...] I'll commit it in sometime soon.
I'm wondering what's holding you back for so long and if the project is still maintained. Do you or any maintainer on the project would need any help to make it happen ?
@sylver
Thing is, you apparently already had a fix a year ago and stated in the last update on this issue :
Yep.
I'm wondering what's holding you back for so long
Life.
if the project is still maintained.
Yep.
Do you or any maintainer on the project would need any help to make it happen ?
I'm the only active maintainer and I've been struggling to find free time to work on unrelated OSS. The pandemic hit us really hard and we're recovering still.
@Qix-
The pandemic hit us really hard and we're recovering still.
Sorry to hear that, hold on there.
I'm the only active maintainer and I've been struggling to find free time to work on unrelated OSS.
That's understandable.
That's not a critical issue anyway, just an annoying one.
But if there's a quick win and I can help to close it with a PR (adding what's missing, unit tests maybe ?), let me know.
@Qix- I have created a PR https://github.com/debug-js/debug/pull/911 for this fix.
It comes with tests as well.
It looks like your fix unfixed itself in the mean time somewhere. Running the test someone mentions above yields this:
DEBUG=FOO DEBUG_DEPTH=40 node bla.js
FOO something { x: 1, y: { a: 2, b: 3, c: { a: 1, b: [Object] } } } +0ms
As you can see, this stil (again?) prints [Object]
It looks like your fix unfixed itself in the mean time somewhere. Running the test someone mentions above yields this:
DEBUG=FOO DEBUG_DEPTH=40 node bla.js FOO something { x: 1, y: { a: 2, b: 3, c: { a: 1, b: [Object] } } } +0ms
As you can see, this stil (again?) prints
[Object]
My fix wasn't merged. You can try to checkout this branch to see if it works: https://github.com/calvintwr/debug/tree/fix/debug-depth
@Qix- I have created a PR #911 for this fix.
It comes with tests as well.
A new PR is at https://github.com/debug-js/debug/pull/926
Looks like it works as expected now:
$ 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
$ DEBUG=FOO DEBUG_DEPTH=1 node index.js
FOO something { x: 1, y: { a: 2, b: 3, c: [Object] } } +0ms
@Qix- now that the pandemic is over you think you could merge this? :) #926