一个朋友写的日志库
https://github.com/vizee/echo
go get -u -v github.com/vizee/echo
package main import ( "errors" "os" "github.com/vizee/echo" ) func main() { echo.SetOutput(os.Stdout) echo.SetLevel(echo.DebugLevel) echo.SetFormatter(&echo.PlainFormatter{}) echo.Debug("debug message1", echo.Int("int", 126), echo.Echo("bytes", echo.BytesEchoer(`233`))) echo.SetLevel(echo.InfoLevel) echo.Debug("debug message2", echo.Int("int", 126)) echo.Info("info message", echo.Var("var", map[string]int{"a": 1, "b": 2})) echo.Warn("warn message", echo.String("string", "blah blah"), echo.Quote("quote", "blah blah")) echo.Error("error message", echo.Errors("err", errors.New("oops!"))) echo.Fatal("fatal message", echo.Stack(true)) }