chrisa / node-dtrace-provider

Native DTrace probes for node.js apps
Other
320 stars 68 forks source link

Possibility to suppress DTraceProviderBindings Errors #109

Closed ErisDS closed 6 years ago

ErisDS commented 6 years ago

I'm using bunyan, which makes use of this library, however I don't need the Dtrace functionality when developing locally & running my tests.

I'm using node with nvm + yarn & on El Capitan, and I believe somewhere in that combo, I end up without the bindings.

Fact is, I don't really care - it doesn't have any impact & so it's pointless debugging which aspect of that combo is tripping up the install. The code here has a catch block:

https://github.com/chrisa/node-dtrace-provider/blob/master/dtrace-provider.js#L18

And so does this:

https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L77

But this block here:

https://github.com/chrisa/node-dtrace-provider/blob/master/dtrace-provider.js#L33

Overrides those try/catches and prints an error anyway.

This means when I'm running tests locally, I cannot see the output from mocha in between endless errors from this module.

I understand why the code is there, but it really isn't useful in this case.

Could we perhaps suppress these errors when NODE_ENV === testing? Or have some other flag that disables them please? Happy to PR, but wanted to check first.

davepacheco commented 6 years ago

Sorry about the issue. There's discussion about a related issue in #96 (which I've edited slightly to reflect this case).

ErisDS commented 6 years ago

Ok I'll move this to #96