Skip to content

Commit

Permalink
optimise k.Kind() = string
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpionknifes committed Sep 19, 2024
1 parent 3fe7bb8 commit ade9f40
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bridges/otellogr/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ func convertValue(v any) log.Value {
kvs := make([]log.KeyValue, 0, val.Len())
for _, k := range val.MapKeys() {
var key string
// If the key is a struct, use %+v to print the struct fields.
if k.Kind() == reflect.Struct {
switch k.Kind() {
case reflect.String:
key = k.String()
default:
key = fmt.Sprintf("%+v", k.Interface())
} else {
key = fmt.Sprintf("%v", k.Interface())
}
kvs = append(kvs, log.KeyValue{
Key: key,
Expand Down

0 comments on commit ade9f40

Please sign in to comment.