node_pcap icon indicating copy to clipboard operation
node_pcap copied to clipboard

Silence console.log

Open jnovack opened this issue 9 years ago • 5 comments

There are times when I just want pcap to do what it's supposed to do and not complain when it sees something it cannot process.

$ sudo node index.js
node_pcap: EthernetFrame() - Don't know how to decode ethertype 4284
node_pcap: EthernetFrame() - Don't know how to decode ethertype 4284
mac address found
node_pcap: EthernetFrame() - Don't know how to decode ethertype 4284

Should the errors be emitted back so that the calling application can decide whether or not it wants to do something about it?

jnovack avatar Oct 03 '15 11:10 jnovack

As part of the work i was doing earlier this year I was attempting to remove all of these console logs. Unfortunately a bit of life has happened since then and I have not been as active as I would like to be. As winter roles around again for me I should get more inside time to work on this.

jmaxxz avatar Oct 13 '15 05:10 jmaxxz

I wasn't complaining, I was opening a discussion. I appreciate your hard work in making my Amazon Dash button useful. :)

Do you feel that emitting them back as "error" (or whatever) is appropriate?

jnovack avatar Oct 13 '15 13:10 jnovack

I submitted https://github.com/mranney/node_pcap/pull/195 to address this (without requiring a major version change). It basically keeps the functionality as-is, but also provides mechanisms to attach it to another logger (like bunyan) or silence the output altogether.

ecaron avatar Jan 17 '16 15:01 ecaron

This is a great first start, although, when including a package that includes node-pcap, it doesn't solve the problem (as the first package would then have to be modified by the calling application).

I would really like to a default silent (if approved by the maintainer).

jnovack avatar Jan 17 '16 19:01 jnovack

@jnovack, I'm in agreement (since my primary interest in this is from https://github.com/hortinstein/node-dash-button/). But I figured silencing it by default would warrant a breaking change from the existing application, and since I wasn't bold enough to suggest a major version that's why I went the passive route.

ecaron avatar Jan 17 '16 20:01 ecaron