nng
nng copied to clipboard
feature request: logging
currently logging is not possible inside the library. for most functions this is not important, but sometimes it's helpful to see if for example packets are dropped or some other debugging stuff.
best solution would be to have a handler the user can register which gets called to (asyncronously!) send it to some external logger.
Sorry to do this... and I know what a mess logging is right now, but addressing this holistically is something that is going to need to wait until the next release. I don't want to hold 1.3 for it.
The main uses for logging (need) is for debugging TLS and HTTP problems. TLS in particular is rather pernicious to debug, and we can't really provide sufficient information back to the caller as an error number.
HTTP logging is more likely to be needed when serving up data generally.
I'm not a fan of logging for the rest of the library, and mostly I feel that logging is the wrong answer -- a better answer is to provide meaningful content (errors) in line, so you don't need the log. HTTP servers and TLS being the one thing where it brings value. (HTTP clients should probably not bother with logging btw.)
Years later, I'm working on this now. Stay tuned.