kataras / kataras/iris

question about iris logger install

Open
#1,685 6 comments 0 reactions 0 assignees View on GitHub
🤔 type:question
Dominant language
Go
Stars
25.6k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

here is my code

main.go
```golang
app := iris.New()
l := logrus.New()
l.SetReportCaller(true)
l.SetFormatter(&logrus.JSONFormatter{})
app.Logger().Install(l)
app.Logger().Println(123)
```

i got this
```linux
{"file":"/Users/sado/go/pkg/mod/github.com/kataras/golog@v0.0.18/integration.go:28","func":"github.com/kataras/golog.integrateExternalLogger.func1","level":"info","msg":"123","time":"2020-12-05T11:41:27+08:00"}
```

when i use this in my router controller, i got this
```linux
{"file":"/Users/sado/go/pkg/mod/github.com/kataras/golog@v0.0.18/integration.go:28","func":"github.com/kataras/golog.integrateExternalLogger.func1","level":"info","msg":"rrrrrrrr","time":"2020-12-05T11:41:47+08:00"}
{"file":"/Users/sado/go/pkg/mod/github.com/kataras/golog@v0.0.18/integration.go:28","func":"github.com/kataras/golog.integrateExternalLogger.func1","level":"info","msg":"200 8.373308ms 127.0.0.1 GET /api/a/b/xxx","time":"2020-12-05T11:41:47+08:00"}

```

my questions:
1) i want {file: "main.go:123"}, not `integration.go:28`, how can i get this?
2) when i use in controller, why this log show twice? how can i avoid this ?

thank u

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.