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 may contain a field formatting error
|
||||||
err string
|
err string
|
||||||
|
|
||||||
|
mu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEntry(logger *Logger) *Entry {
|
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.
|
// 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()
|
entry.mu.Lock()
|
||||||
defer entry.Logger.mu.Unlock()
|
defer entry.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
|
||||||
|
|
Loading…
Reference in New Issue