Question: Not printing line number on error
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 110
- PR merge metrics
- No merged PRs in 30d
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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.