R.I.Pienaar
44.6K posts

R.I.Pienaar
@ripienaar
Systems Architect, Automator, Coder. Instagram: ripienaar. @[email protected]




I was surprised by the results to this! It seems that an awful lot of people still continue to use rs/zerolog and ubergo/zap. Tons of folks using slog from the standard library too. For the folks not using slog, a high proportion of them said they are only not using it because slog didn't exist when they started their project. This makes sense to me- I'm not sure its' worth the effort to pull it out. Why does it matter which logger I use? In most cases, it probably doesn't. However, if you are building for performance then having a logger that does not allocate, slows down your program as little as possible and has the ability to use in a structured way is important. Which is fastest? According to Uber-go's benchmarks, rs/zerolog is the fastest in pretty much all scenarios. So I should use zerolog? Maybe. Generally I try to aim for as few dependencies as possible, as it's something else to be managed. In my own use, slog has been more than fine. If you hit a juncture where logging is a bottleneck, experimenting with zerolog could be worth it! I would bet in most cases you could solve logging bottlenecks by either removing logs, or "tuning down" the log mode. #golang



















