go-lg logger


This is exactly what the world needs, another golang logging library. Nonetheless I’ve published go-lg, a logger intended primarily for dev/trace/debug. The key points:

  • super simple to use
  • outputs in Apache error_log format
  • includes file, line number, and function info in the output. For the intended purpose, it’s better than anything else out there that I know of.

Use it like so:

package example

import "github.com/neilotoole/go-lg/lg"

func ShowMe() {
        lg.Debugf("the answer is: %d", 42)
        lg.Errorf("trouble ahead")
}

That produces:

I [24/Aug/2016:20:26:41 -0600] [example.go:6:example.ShowMe] the answer is: 42
E [24/Aug/2016:20:26:41 -0600] [example.go:7:example.ShowMe] trouble ahead

Check out the GitHub project page for more.