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

Usage of Observation.inspect() method is ambiguous #6

Open
soswow opened this issue May 19, 2016 · 1 comment
Open

Usage of Observation.inspect() method is ambiguous #6

soswow opened this issue May 19, 2016 · 1 comment

Comments

@soswow
Copy link

soswow commented May 19, 2016

In your example you call .inspect method on observation directly control.inspect(). But in your test you don't do that. Instead you call util.inspect with argument of an observation and options object {depth: -1}.
Method inspect has two arguments: depth, options. depth is not being use in method itself, but it's required if you want to use util.inspect. But If I want to call inspect method itself I need to call it like control.inspect(null, {depth: -1}) even though first argument is called depth
I hope it's clear why it caused me 30 minutes of time realising what's going on and why.

@dpatti
Copy link
Contributor

dpatti commented May 19, 2016

Hey @soswow, sorry you had to struggle to get things to work. I'm not sure I understand what your issue is, exactly. The inspect() method on Observation should be able to be called directly with 0 parameters (control.inspect()) or through node's inspect indirectly (util.inspect(control, options)). I know the fact that it takes the depth parameter is confusing, but that is what the node docs ask for. The reason depth isn't used is because it's more complication than I'd like for something so simple, but I did want to forward the options argument that node would provide.

If you have examples of other libraries implementing inspect() in a more reasonable way, I'd love to see them! My only thought is that we could change the function signature to inspect([depth, ]options) to satisfy both scenarios without as much confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants