Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEBUG_DEPTH not working #746

Closed
anishkny opened this issue Feb 8, 2020 · 25 comments · Fixed by #926
Closed

DEBUG_DEPTH not working #746

anishkny opened this issue Feb 8, 2020 · 25 comments · Fixed by #926
Labels
bug This issue identifies a malfunction

Comments

@anishkny
Copy link

anishkny commented Feb 8, 2020

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: 'xxx@yyy.com', vars: [ [Object] ] } ]

My invocation:

debug('STRING', targetObj);
@chriskinsman
Copy link

Noticed this also. Looks like it is defaulting to 3 and not allowing an override...

Any fix in the works?

@Qix-
Copy link
Member

Qix- commented Jul 8, 2020

Yep looks like a regression somewhere.

@Qix- Qix- added the bug This issue identifies a malfunction label Jul 8, 2020
Qix- added a commit that referenced this issue Jul 8, 2020
@Qix-
Copy link
Member

Qix- commented Jul 8, 2020

Can you test with npm i --no-save visionmedia/debug#fix/depth?

@Qix-
Copy link
Member

Qix- commented Jul 8, 2020

Started down the git blame rabbit hole. If that branch fixes it, then this has been broken for years. Amazing.

@anishkny
Copy link
Author

anishkny commented Jul 8, 2020

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

@Qix-
Copy link
Member

Qix- commented Jul 8, 2020

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 :)

@sylver
Copy link

sylver commented May 21, 2021

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.

@Qix-
Copy link
Member

Qix- commented May 21, 2021

What is the status on this issue?

image

@sylver
Copy link

sylver commented May 21, 2021

@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

@Qix-
Copy link
Member

Qix- commented May 22, 2021

There is no update.

@sylver
Copy link

sylver commented May 22, 2021

@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 ?

@Qix-
Copy link
Member

Qix- commented May 22, 2021

@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.

@sylver
Copy link

sylver commented May 22, 2021

@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.

@calvintwr
Copy link
Contributor

@Qix- I have created a PR #911 for this fix.

It comes with tests as well.

@eavdmeer
Copy link

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]

@calvintwr
Copy link
Contributor

calvintwr commented Feb 12, 2023

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 #926

@eavdmeer
Copy link

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

@piboistudios
Copy link

piboistudios commented May 15, 2023

@Qix- now that the pandemic is over you think you could merge this? :) #926

@7elephants
Copy link

As we are coming up on the year anniversary of #926, @Qix- have things calmed down some to review this and merge?

Not critical, would really help....

@calvintwr
Copy link
Contributor

@7elephants this project is abandoned. We are maintaining it at https://github.com/calvintwr/debug-next

@eavdmeer
Copy link

Abandoned at 200M weekly download versus 80 for debug-next???

@calvintwr
Copy link
Contributor

@7elephants the original debug team abandoned this project. We are not associated with them. We forked the repo and maintain it separately as a drop in replacement, with bug fixes and extra features that we needed.

@Qix-
Copy link
Member

Qix- commented May 31, 2024

@calvintwr please stop spreading misinfo. It's not abandoned. You're welcome to fork but it's not entirely easy to maintain this package as I'd like to. If you would check the issues I've been more than transparent about the current status of the project and why development is ridiculously slow.

@Qix- Qix- closed this as completed in #926 May 31, 2024
@Qix-
Copy link
Member

Qix- commented May 31, 2024

Released as 4.3.5.

@eavdmeer
Copy link

@Qix- Thanks for the update. That debug-next fork is interesting, but I strongly prefer debug as it keeps things exactly as they should be: simple!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue identifies a malfunction
Development

Successfully merging a pull request may close this issue.

8 participants