Skip to content

Commit

Permalink
simplify appending in convertFields
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Apr 24, 2024
1 parent fb7aadf commit 40e0251
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions bridges/otellogrus/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,12 @@ func (h *Hook) convertEntry(e *logrus.Entry) log.Record {
}

func convertFields(fields logrus.Fields) []log.KeyValue {
kvs := make([]log.KeyValue, len(fields))

i := 0
kvs := make([]log.KeyValue, 0, len(fields))
for k, v := range fields {
kvs[i] = log.KeyValue{
kvs = append(kvs, log.KeyValue{
Key: k,
Value: convertValue(v),
}
i++
})
}
return kvs
}
Expand Down

0 comments on commit 40e0251

Please sign in to comment.