forked from mirror/logrus
commit
91ef3ab5d5
2
entry.go
2
entry.go
|
@ -122,8 +122,6 @@ func (entry *Entry) WithField(key string, value interface{}) *Entry {
|
||||||
|
|
||||||
// Add a map of fields to the Entry.
|
// Add a map of fields to the Entry.
|
||||||
func (entry *Entry) WithFields(fields Fields) *Entry {
|
func (entry *Entry) WithFields(fields Fields) *Entry {
|
||||||
entry.Logger.mu.Lock()
|
|
||||||
defer entry.Logger.mu.Unlock()
|
|
||||||
data := make(Fields, len(entry.Data)+len(fields))
|
data := make(Fields, len(entry.Data)+len(fields))
|
||||||
for k, v := range entry.Data {
|
for k, v := range entry.Data {
|
||||||
data[k] = v
|
data[k] = v
|
||||||
|
|
|
@ -210,7 +210,7 @@ func TestEntryWithIncorrectField(t *testing.T) {
|
||||||
|
|
||||||
fn := func() {}
|
fn := func() {}
|
||||||
|
|
||||||
e := &Entry{Logger: New()}
|
e := Entry{}
|
||||||
eWithFunc := e.WithFields(Fields{"func": fn})
|
eWithFunc := e.WithFields(Fields{"func": fn})
|
||||||
eWithFuncPtr := e.WithFields(Fields{"funcPtr": &fn})
|
eWithFuncPtr := e.WithFields(Fields{"funcPtr": &fn})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue