mirror of
https://github.com/libp2p/go-libp2p-resource-manager.git
synced 2025-03-10 17:20:39 +08:00
add a timestamp to trace events (#34)
This commit is contained in:
parent
2e798e3cc5
commit
50387915ba
4
trace.go
4
trace.go
@ -47,6 +47,7 @@ const (
|
||||
)
|
||||
|
||||
type traceEvt struct {
|
||||
Time string
|
||||
Type string
|
||||
|
||||
Scope string `json:",omitempty"`
|
||||
@ -70,13 +71,14 @@ type traceEvt struct {
|
||||
FD int `json:",omitempty"`
|
||||
}
|
||||
|
||||
func (t *trace) push(evt interface{}) {
|
||||
func (t *trace) push(evt traceEvt) {
|
||||
t.mx.Lock()
|
||||
defer t.mx.Unlock()
|
||||
|
||||
if t.done {
|
||||
return
|
||||
}
|
||||
evt.Time = time.Now().Format(time.RFC3339)
|
||||
|
||||
t.pend = append(t.pend, evt)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user