This is a creation in Article, where the information may have evolved or changed.
In the Go language world, the log library is not like the Java world where there is a dominant log library. In the new project technology selection, will inevitably encounter the choice of log library, today I would like to introduce you to the most stars in GitHub go log library.
Logrus is the most powerful and performance-rich log library in the Go Language Log library that has the highest number of stars in GitHub. Also worth mentioning is Logrus a fork library Gogap/logrus, can be configured to output to the file and Graylog log system, the base level, call chain, line number, file segmentation has, feature is structured log can be counted and indexed, With Graylog, you can do log analysis, but this library has not been maintained for a long time.
Zap is a fast, structured, graded log library for go, with Uber. The ability to activate powerful Ad-hoc analysis, flexible dashboards, features more than other tools elk, Splunk, and Sentry. All log messages are json-serialized. It is also one of the log libraries currently used by the author.
Zerolog is also a fairly good log library, and it's interesting that both Zerolog and Zap beat each other in performance comparison data in their home GitHub Library homepage:)
Seelog is a native Go log library that provides flexible asynchronous scheduling, filtering, and formatting. This is also the author of the earlier use of the Go Log library.
Blog4go is a high performance log library. Innovative use of the "Edge resolution Edge Output" method for log output while supporting callback functions, log obsolescence, and configuration files. can solve the high concurrency, the call log function frequently in the context of the log library caused by performance problems.
Some GitHub libraries have few star numbers, but many features, such as Mkideal/log, Go-log, Alog, and so on, are very well-equipped log libraries, easy to use. There are also some small help libraries for development projects, such as HAPPIERALL/L.
Here is my list of Go Language Log library, you can choose according to the actual needs of your project (if you have a good Go log library recommendations, please leave a message to share).
Project Name |
Stars |
Forks |
Description |
Logrus |
5471 |
775 |
Structured, pluggable logging for Go. |
Zap |
2761 |
175 |
Blazing fast, structured, leveled logging in Go. |
Oklog |
1914 |
61 |
A distributed and Coördination-free Log management system |
Glog |
1496 |
307 |
Leveled execution logs for Go |
Seelog |
960 |
173 |
Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting. |
Log15 |
625 |
79 |
Structured, composable logging for Go |
Zerolog |
444 |
18 |
Zero Allocation JSON Logger |
Apex/log |
433 |
38 |
Structured logging package for Go. |
Log |
215 |
14 |
Simple, configurable and scalable structured Logging for Go. |
Blog4go |
189 |
31 |
Blog4go is a efficient logging library written in the Go programming language, providing logging hook, log rotate, filter ing and formatting log message. |
Logutils |
176 |
18 |
Utilities for slightly better logging in Go (Golang). |
Log4go |
161 |
109 |
Logging package similar to log4j for the Go programming language |
FileLogger |
80 |
27 |
FileLogger is an asynchronous log library based on go development that can automatically split files for backup |
Gogap/logrus |
75 |
775 |
Obsolete refer to Gogap/logrus_mate |
Ozzo-log |
74 |
17 |
A Go (Golang) package providing high-performance asynchronous logging, message filtering by severity and category, and Mul Tiple message targets. |
Azer/logger |
74 |
9 |
Minimalistic logging library for Go. |
Alexcesaro/log |
42 |
4 |
Logging Packages for Go |
happierall/l |
33 |
3 |
Golang pretty logger.custom go Logger for pretty print, log, debug, warn, error with colours and levels. |
Mkideal/log |
33 |
2 |
Pluginable, fast,structrued and leveled logging package |
Slf |
33 |
1 |
Structured Logging facade (SLF) for Go |
Logex |
29 |
6 |
An Golang log lib, supports tracking and level, wrap by standard log lib |
Gologger |
26 |
5 |
Simple Logger for Golang. Logs into console, file or ElasticSearch. Simple-easy-to-use. |
Go-log |
24 |
9 |
A logger, for Go |
Slog |
22 |
1 |
The reference SLF (structured logging facade) implementation for Go |
Cxr29/log |
18 |
14 |
Log-go level and rotate log |
Ulog |
15 |
2 |
Ulog-structured and context based logging for Golang |
Siddontang/go-log |
14 |
5 |
A Golang log Lib supports level and multi handlers |
Ccpaging/log4go |
13 |
109 |
Logging package similar to log4j for the Go programming language |
Mlog |
11 |
9 |
A Simple logging module for go, with a rotating file feature and console logging. |
Alog |
6 |
2 |
Golang Async Log Package |
Golog |
5 |
1 |
Golog is a multilayer & leveled & structured logger for Golang. |
Szxp/log |
5 |
0 |
A Small structured logging library for Golang |
Go-async-log |
4 |
2 |
Golang Asynchronous Log Library, support asynchronous batch writing, automatic cutting by day or hour, error level, multiple files, etc. |
Log |
1 |
1 |
A Golang-based log module |
Finally is two benchmark library, provides the performance comparison data of some go log library, for you to do the technical selection of reference
- Https://github.com/hnakamur/go-log-benchmarks
- Https://github.com/imkira/go-loggers-bench