logrus icon indicating copy to clipboard operation
logrus copied to clipboard

Entry.WithFields(): copy the original entry

Open Julio-Guerra opened this issue 7 years ago • 1 comments

Entry.WithFields() currently creates a new Entry and partially copies it. Calling several times WithFields() on an already logged entry (e.g. in a formatter) thus leads to an incorrectly initialized Entry structure.

The patch makes the method copy the original entry and only modify the Data member with the new set of fields. So that calling several times WithFields() on an already logged entry (e.g. in a formatter Format() method) avoids this problem.

Julio-Guerra avatar May 05 '17 21:05 Julio-Guerra

We should probably fix #529 first because merging this will cause race detector to go nuts.

DmitriyMV avatar May 15 '17 13:05 DmitriyMV