apex / apex/log

Question: Not printing line number on error

Aperta
#48 1 commento 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
1.4k
Fork
110
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.