News for hackers. Stuff that matters.
Re:Discussion: structured, leveled logging by egnehots on Sunday September 11, 2022 @03:07PM (#32802343)
Prior Work

- The existing log package has been in the standard library since the release of Go 1 in March 2012. It provides formatted logging, but not structured logging or levels.

- Logrus, one of the first structured logging packages, showed how an API could add structure while preserving the formatted printing of the log package. It uses maps to hold key-value pairs, which is relatively inefficient.

- Zap grew out of Uber's frustration with the slow log times of their high-performance servers. It showed how a logger that avoided allocations could be very fast.

- zerolog reduced allocations even further, but at the cost of reducing the flexibility of the logging backend.

- All the above loggers include named levels along with key-value pairs. Logr and Google's own glog use integer verbosities instead of named levels, providing a more fine-grained approach to filtering high-detail logs.

Other popular logging packages are Go-kit's log, HashiCorp's hclog, and klog.

There are no comments on this comment yet.