Question: Not printing line number on error
- 主要语言
- Go
- 星标
- 1.4k
- 派生
- 110
- PR 合并指标
- 30 天内没有已合并 PR
描述
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
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。