A fast logger for Go.
Install with:
go get github.com/msales/logged
// Composable handlers
h := logged.LevelFilterHandler(
logged.Info,
logged.StreamHandler(os.Stdout, logged.LogfmtFormat()),
)
// The logger can have an initial context
l := logged.New(h, "env", "prod")
// All messages can have a context
l.Warn("connection error", "redis", conn.Name(), "timeout", conn.Timeout())
Will log the message
lvl=warn msg="connection error" redis=dsn_1 timeout=0.500
MIT-License. As is. No warranties whatsoever. Mileage may vary. Batteries not included.