apex / apex/log

Question: Not printing line number on error

Đang mở
#48 1 bình luận 3 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
1.4k
Fork
110
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.