English | 简体中文
This package is a library of ZKits project. This is a zero-dependency standard JSON log library that supports structured JSON logs and is compatible with the standard library.
- Flexible and controllable caller report.
- Support 7 log levels.
- Complete log standard library compatibility.
- Chained call, supporting additional log context data.
- Flexible log hook support.
- Custom log formatter support.
go get -u -v github.com/edoger/zkits-logger
package main
import "github.com/edoger/zkits-logger"
func main() {
// Creates a logger instance with the specified name.
log := logger.New("test")
// {"level":"info","message":"Hello.","name":"test","time":"2020-02-20T20:20:20+08:00"}
log.Info("Hello.")
// {"fields":{"num":1},"level":"info","message":"Hello.","name":"test","time":"2020-02-20T20:20:20+08:00"}
log.WithField("num", 1).Info("Hello.")
}