Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

add a timestamp to trace events #34

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
)

type traceEvt struct {
Time string
Type string

Scope string `json:",omitempty"`
Expand All @@ -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)
}
Expand Down