Browse Source

return new entry for Entry.WithContext

tags/v1.4.1
Haoran Xu 6 months ago
parent
commit
38bc297a3d
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      entry.go

+ 1
- 2
entry.go View File

@@ -103,8 +103,7 @@ func (entry *Entry) WithError(err error) *Entry {
103 103
 
104 104
 // Add a context to the Entry.
105 105
 func (entry *Entry) WithContext(ctx context.Context) *Entry {
106
-	entry.Context = ctx
107
-	return entry
106
+	return &Entry{Logger: entry.Logger, Data: entry.Data, Time: entry.Time, err: entry.err, Context: ctx}
108 107
 }
109 108
 
110 109
 // Add a single field to the Entry.

Loading…
Cancel
Save