improvement: refactor Tendermint logger by using zerolog#6534
improvement: refactor Tendermint logger by using zerolog#6534alexanderbez merged 25 commits intomasterfrom
Conversation
|
Is there some conversation somewhere that I've missed as to why this logger is better than other loggers, or where we decided to change? |
#3428 although the title says zap the conversation says zero log. Also apps can easily override, and many do, the logger. I would say this is more of reducing maintenance burden of a custom logger. |
|
No major discussions @tychoish. We expose a Tendermint implements a "default" one, but it was an archaic and convoluted series of wrappers around go-kit and very slow compared to zerolog, which is very performant and has good ergonomics. |
tychoish
left a comment
There was a problem hiding this comment.
not that logging performance is really ever an issue, but...
|
We need the logger to be thread-safe, which zerolog supports...I'm gonna put this PR on pause. |
It has caused issues in the past at least in some testing areas. Not sure that there needs to be a further discussion here, does there? The pr is already here, lets just wrap it up and merge it. Less code is always better, IMO. |
The testing logger problem is almost certainly not about the raw speed of the logger and rather about the volume of log messages when the system runs quickly (combined with the way that the testing logger writes to standard output, and the logger is multiplexed between tests. I agree, however, that this is a fine change. |
|
It's a win for two reasons: (1) We have a more performant logger (which does matter, albeit can be little), and (2) we removed +1k lines of useless code. |
|
Yeah, let's do it. |
libs/log/logger.go
Outdated
| LogLevelWarn = "warn" | ||
| LogLevelError = "error" | ||
| LogLevelFatal = "fatal" |
There was a problem hiding this comment.
Do we support warn and fatal?
There was a problem hiding this comment.
We don't technically, although I think we should support warn at the least. What do you think? I'll remove fatal.
There was a problem hiding this comment.
Makes sense, do you need to update the interface to expose it as well?
Codecov Report
@@ Coverage Diff @@
## master #6534 +/- ##
==========================================
- Coverage 60.50% 60.44% -0.06%
==========================================
Files 299 294 -5
Lines 27883 27703 -180
==========================================
- Hits 16870 16746 -124
+ Misses 9296 9251 -45
+ Partials 1717 1706 -11
|
docs need to be updated to reflect this. Mainly logging.md |
Remove a lot of custom logging code in favor of a simple wrapper around zerolog. The interface and auxiliary types (testing and nop) remain.
NOTE: This removes the ability for Tendermint's default logger to provide field filtering, e.g.
abci:info.