How to implement level based logging in golang?

前端 未结 11 2219
谎友^
谎友^ 2020-12-24 04:44

Is there any good wrapper available for level based logging in golang? If not, how should I go about implementing one myself?

What I want is pretty simple. I want a

11条回答
  •  情深已故
    2020-12-24 05:23

    • Uber-go/Zap: Fast, structured, leveled logging in Go
    • Logrus: Structured, pluggable logging for Go. (JSON and text formatting)

    Both libraries have level hooks also, which is a very interesting feature. Hooks can be registered for particular log levels. So for example any error(logged using log.Error()) occurs you can report to some monitoring tool etc.

提交回复
热议问题