An open API service indexing awesome lists of open source software.

https://github.com/keepeye/logrus-filename

Logrus hook for logging filename and line number
https://github.com/keepeye/logrus-filename

go logger logrus logrus-hook

Last synced: 5 months ago
JSON representation

Logrus hook for logging filename and line number

Awesome Lists containing this project

README

          

This package is extracted from [onrik/logrus][1].

USAGE
======

```go
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:

```go
INFO[0000] aha line="box-api-server/test.go:12"
```

[1]: https://github.com/onrik/logrus