Question: Not printing line number on error
- Langage dominant
- Go
- Étoiles
- 1.4k
- Forks
- 110
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Hi I ran the tracing sample but it was not printing the line number. This is my current output.
```sh
INFO[0001] opening app=myapp env=prod path=Readme.md
ERROR[0001] opening app=myapp duration=22.987µs env=prod error=open Readme.md: no such file or directory path=Readme.md
INFO[0002] opening app=myapp env=prod path=Readme.md
ERROR[0002] opening app=myapp duration=8.866µs env=prod error=open Readme.md: no such file or directory path=Readme.md
```
My code is (taken from the tracing examlple)
```go
package main
import (
"os"
"time"
"github.com/apex/log"
"github.com/apex/log/handlers/text"
)
func work(ctx log.Interface) (err error) {
path := "Readme.md"
defer ctx.WithField("path", path).Trace("opening").Stop(&err)
_, err = os.Open(path)
return
}
func main() {
log.SetHandler(text.New(os.Stderr))
ctx := log.WithFields(log.Fields{
"app": "myapp",
"env": "prod",
})
for range time.Tick(time.Second) {
_ = work(ctx)
}
}
```
go version go1.8.3 darwin/amd64
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.