A pretty logger for Go
Requires the Go programming language binaries with the GOPATH environment variable specified and $GOPATH/bin in your PATH.
If your project does not use the vendoring tool Glide to manage dependencies, you can install this package like you would any other:
go get github.com/unchartedsoftware/plogWhile this is the simplest way to install the package, due to how go get resolves transitive dependencies it may result in version incompatibilities.
This is the recommended way to install the package and ensures all transitive dependencies are resolved to their compatible versions.
glide get github.com/unchartedsoftware/plogNOTE: Requires Glide along with Go version 1.6+.
package main
import (
"github.com/unchartedsoftware/plog"
)
func main() {
log.Debug("This is a debug level log")
log.Info("This", "is", "an", "info", "level", "log")
log.Warnf("This is a %s level log", "warn")
log.Error("This is an error level log")
// only log warnings and errors
log.SetLevel(log.WarnLevel)
log.Debug("This is a debug level log, I will be ignored")
log.Info("This is an info level log, I will be ignored too")
log.Warn("This is a warn level log, you will see me")
log.Error("This is an error level log, you will see me too")
}