Skip to content

dcmn-com/jlo

Repository files navigation

jlo

Light-weight json logging in go

  • Default log level: INFO
  • Minimum go version/dependencies: See go.mod
  • Release versioning: Semantic versioning/MAJOR.MINOR.PATCH
  • Suggestions/problems: Please create an issue

Usage

l := jlo.NewLogger(os.Stdout)
l.Infof("I'm real")

l.SetLogLevel(jlo.DebugLevel)
l.Debugf("what you get is what you %s", "see")

l = l.WithField("@request_id", "aa33ee55")
l.Errorf("What you tryna to do to me?")

Example output

{"@timestamp": "2018-08-17T13:24:08.856339554Z","@level":"info","@message": "I'm real"}
{"@timestamp": "2018-08-17T13:24:08.856339554Z","@level":"debug","@message": "what you get is what you see"}
{"@timestamp": "2018-08-17T13:24:08.856391733Z","@level":"error","@request_id":"aa33ee55","@message": "What you tryna to do to me?"}
...

Maintainers: