Closed pedropombeiro closed 5 years ago
Regarding @adambabik's question about using UTC timestamps, it looks like zap allows you to configure all encoders with https://godoc.org/go.uber.org/zap/zapcore#EncoderConfig
So we could customize TimeEncoder
with a function that does what we need. That would be done at the caller level though (this PR assumes we receive a pre-configured instance of the zap logger).
Not bad, not bad.
You may draw some inspiration from how we do structured logging in Nim: https://github.com/status-im/nim-chronicles/
Or not :) On a more serious note, if you ever go into logging to json, we are developing a tailing tool that might help you as well. It's able to reformat the json output to a more human-readable form and it can do some interactive searching and filtering on the fly.
Closes #21
This PR replaces the use of the standard log package with Uber's zap structured logging package. The
Messenger
class takes an instance of a logger and propagates it to downstream classes. I selected this library after reading this article.I've avoided using the sugared version of the API in order to obtain the absolute maximum performance since the calls to the base version don't look too bad.