Skip to content

Commit

Permalink
pkg: allocate the space to []zap.Field at beginning.
Browse files Browse the repository at this point in the history
  • Loading branch information
YoyinZyc committed Sep 25, 2019
1 parent 5600c67 commit 59fd194
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/traceutil/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,10 @@ func (t *Trace) logInfo(threshold time.Duration) (string, []zap.Field) {
lastStepTime = step.time
}

var fs []zap.Field
fs = append(fs,
zap.String("detail", writeFields(t.fields)),
fs := []zap.Field{zap.String("detail", writeFields(t.fields)),
zap.Duration("duration", totalDuration),
zap.Time("start", t.startTime),
zap.Time("end", endTime),
zap.Strings("steps", steps))
zap.Strings("steps", steps)}
return msg, fs
}

0 comments on commit 59fd194

Please sign in to comment.