Logx is simple and fast logging library designed taking into account to work in the containerized environments.
In the base Logx using go build tags to configure logging level.
package main
import "github.com/akaspin/logx"
func main() {
log := logx.GetLog("test")
log.Trace("too chatty")
log.Debug("less chatty")
log.Info("ok")
log.Notice("something serious")
log.Warning("oh")
log.Error("bang")
}
By default all trace and debug calls are completely omitted from output:
$ go run ./main.go
INFO test main.go:10 ok
NOTICE test main.go:11 something serious
WARNING test main.go:12 oh
ERROR test main.go:13 bang
To make app extremely chatty use "trace" build tag:
$ go run -tags=trace ./main.go
TRACE test main.go:8 too chatty
DEBUG test main.go:9 less chatty
INFO test main.go:10 ok
NOTICE test main.go:11 something serious
WARNING test main.go:12 oh
ERROR test main.go:13 bang
In opposite to make app quiet use "notice":
$ go run -tags=notice ./main.go
NOTICE test main.go:11 something serious
WARNING test main.go:12 oh
ERROR test main.go:13 bang