We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32942cc commit 23a5dc5Copy full SHA for 23a5dc5
log.go
@@ -5,6 +5,7 @@ import (
5
"fmt"
6
"io"
7
"log"
8
+ "maps"
9
"os"
10
"reflect"
11
"slices"
@@ -21,22 +22,16 @@ type LogFields map[string]interface{}
21
22
func (l LogFields) Add(newFields LogFields) LogFields {
23
resultFields := make(LogFields, len(l)+len(newFields))
24
- for field, value := range l {
25
- resultFields[field] = value
26
- }
27
- for field, value := range newFields {
28
29
+ maps.Copy(resultFields, l)
+ maps.Copy(resultFields, newFields)
30
31
return resultFields
32
}
33
34
// Copy copies the LogFields.
35
func (l LogFields) Copy() LogFields {
36
cpy := make(LogFields, len(l))
37
- for k, v := range l {
38
- cpy[k] = v
39
+ maps.Copy(cpy, l)
40
41
return cpy
42
0 commit comments