node-pcap / node_pcap

libpcap bindings for node
MIT License
932 stars 256 forks source link

Silence console.log #183

Open jnovack opened 9 years ago

jnovack commented 9 years ago

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?

jmaxxz commented 9 years ago

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.

jnovack commented 9 years ago

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?

ecaron commented 8 years ago

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.

jnovack commented 8 years ago

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

ecaron commented 8 years ago

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