This package is extracted from onrik/logrus.
package main
import (
"github.com/sirupsen/logrus"
"github.com/keepeye/logrus-filename"
)
func main() {
filenameHook := filename.NewHook()
filenameHook.Field = "line"
logrus.AddHook(filenameHook)
logrus.Info("aha")
}
output:
INFO[0000] aha line="box-api-server/test.go:12"