forked from mirror/logrus
Compare commits
1 Commits
master
...
move-lock-
Author | SHA1 | Date |
---|---|---|
Mark Phelps | cc70782477 |
6
entry.go
6
entry.go
|
@ -75,6 +75,8 @@ type Entry struct {
|
|||
|
||||
// err may contain a field formatting error
|
||||
err string
|
||||
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func NewEntry(logger *Logger) *Entry {
|
||||
|
@ -122,8 +124,8 @@ func (entry *Entry) WithField(key string, value interface{}) *Entry {
|
|||
|
||||
// Add a map of fields to the Entry.
|
||||
func (entry *Entry) WithFields(fields Fields) *Entry {
|
||||
entry.Logger.mu.Lock()
|
||||
defer entry.Logger.mu.Unlock()
|
||||
entry.mu.Lock()
|
||||
defer entry.mu.Unlock()
|
||||
data := make(Fields, len(entry.Data)+len(fields))
|
||||
for k, v := range entry.Data {
|
||||
data[k] = v
|
||||
|
|
Loading…
Reference in New Issue