elsehow/signal-protocol

Remove console.log in src/

Closed this issue · 5 comments

There are a few places where we console.log informative messages, resulting in a console with messages like:

New remote ephemeral key
Duplicate PreKeyMessage for session
Duplicate PreKeyMessage for session

I think each of these messages should get emitted over some emitter returned by the highest-level entity that makes sense (sessionCiphers come to mind).

The debug module might also work.

@derhuerst That could be good!

I am not sure yet which of these messages the caller might care about or want to work with programmatically, and which of these messages are, "everything is working fine, FYI!"

Theoretically, all the messages that a caller is interested in should be available via returns values, events, or something similar. Console logging a very unintuitive and also inflexible way of getting messages, but certainly necessary in debugging. That's why I propose debug for internal messages that only contain messages related to the inner workings of the module and events/return values/exceptions for all messages interesting to "outsiders".

Sounds good to me. If someone ends up needing a value or event, we can always pass it up as an event later.

As an initial step, I may just go through and comment out all of the console.log statements. The comments can serve as a guide for helpful things to debug.

I commented out all the console.logs in 79f7037 and published v0.0.6

I think I will close this issue for now. If callers end up needing these messages, we can use debug or whatever else makes sense for their usecase 👍