这个版本是copy的CodyGuo同学的 https://github.com/CodyGuo/glog
如果你看到这些文字,请点击 https://github.com/CodyGuo/glog 看作者的。
Package glog implements a log infrastructure for Go.
Let's have a look at an example which demonstrates most of the features found in this library.
package main
import (
"os"
"github.com/Lizhengyan/glog"
)
func main() {
glog.Debug("hello debug")
glog.Info("hello info")
customLog := glog.New(os.Stdout,
glog.WithLevel(glog.TRACE),
glog.WithLevelLength(4),
glog.WithFlags(glog.LglogFlags),
glog.WithPrefix("[customLog] "))
customLog.Trace("hello trace")
customLog.Debug("hello debug")
customLog.Info("hello info")
customLog.Notice("hello notice")
customLog.Warning("hello warning")
customLog.Error("hello error")
customLog.Critical("hello critical")
}
$ go get github.com/Lizhengyan/glog
You can use go get -u
to update the package.
$ go test -bench . -benchmem
For docs, see http://godoc.org/github.com/Lizhengyan/glog or run:
$ godoc github.com/Lizhengyan/glog