@@ -76,7 +76,7 @@ func SetContext(ctx context.Context, e Entry) context.Context {
7676func GetContext (ctx context.Context ) Entry {
7777 v := ctx .Value (ctxIdent )
7878 if v == nil {
79- return newEntryWithFields ( nil )
79+ return newEntry ( )
8080 }
8181 return v .(Entry )
8282}
@@ -178,125 +178,123 @@ func WithDefaultFields(fields ...Field) {
178178
179179// WithField returns a new log entry with the supplied field.
180180func WithField (key string , value interface {}) Entry {
181- ne := newEntryWithFields (logFields )
182- ne .Fields = append (ne .Fields , Field {Key : key , Value : value })
181+ ne := newEntry (Field {Key : key , Value : value })
183182 return ne
184183}
185184
186185// WithFields returns a new log entry with the supplied fields appended
187186func WithFields (fields ... Field ) Entry {
188- ne := newEntryWithFields (logFields )
189- ne .Fields = append (ne .Fields , fields ... )
187+ ne := newEntry (fields ... )
190188 return ne
191189}
192190
193191// WithTrace with add duration of how long the between this function call and
194192// the subsequent log
195193func WithTrace () Entry {
196- ne := newEntryWithFields ( logFields )
194+ ne := newEntry ( )
197195 ne .start = time .Now ()
198196 return ne
199197}
200198
201199// WithError add a minimal stack trace to the log Entry
202200func WithError (err error ) Entry {
203- ne := newEntryWithFields ( logFields )
201+ ne := newEntry ( )
204202 return withErrFn (ne , err )
205203}
206204
207205// Debug logs a debug entry
208206func Debug (v ... interface {}) {
209- e := newEntryWithFields ( logFields )
207+ e := newEntry ( )
210208 e .Debug (v ... )
211209}
212210
213211// Debugf logs a debug entry with formatting
214212func Debugf (s string , v ... interface {}) {
215- e := newEntryWithFields ( logFields )
213+ e := newEntry ( )
216214 e .Debugf (s , v ... )
217215}
218216
219217// Info logs a normal. information, entry
220218func Info (v ... interface {}) {
221- e := newEntryWithFields ( logFields )
219+ e := newEntry ( )
222220 e .Info (v ... )
223221}
224222
225223// Infof logs a normal. information, entry with formatting
226224func Infof (s string , v ... interface {}) {
227- e := newEntryWithFields ( logFields )
225+ e := newEntry ( )
228226 e .Infof (s , v ... )
229227}
230228
231229// Notice logs a notice log entry
232230func Notice (v ... interface {}) {
233- e := newEntryWithFields ( logFields )
231+ e := newEntry ( )
234232 e .Notice (v ... )
235233}
236234
237235// Noticef logs a notice log entry with formatting
238236func Noticef (s string , v ... interface {}) {
239- e := newEntryWithFields ( logFields )
237+ e := newEntry ( )
240238 e .Noticef (s , v ... )
241239}
242240
243241// Warn logs a warning log entry
244242func Warn (v ... interface {}) {
245- e := newEntryWithFields ( logFields )
243+ e := newEntry ( )
246244 e .Warn (v ... )
247245}
248246
249247// Warnf logs a warning log entry with formatting
250248func Warnf (s string , v ... interface {}) {
251- e := newEntryWithFields ( logFields )
249+ e := newEntry ( )
252250 e .Warnf (s , v ... )
253251}
254252
255253// Panic logs a panic log entry
256254func Panic (v ... interface {}) {
257- e := newEntryWithFields ( logFields )
255+ e := newEntry ( )
258256 e .Panic (v ... )
259257}
260258
261259// Panicf logs a panic log entry with formatting
262260func Panicf (s string , v ... interface {}) {
263- e := newEntryWithFields ( logFields )
261+ e := newEntry ( )
264262 e .Panicf (s , v ... )
265263}
266264
267265// Alert logs an alert log entry
268266func Alert (v ... interface {}) {
269- e := newEntryWithFields ( logFields )
267+ e := newEntry ( )
270268 e .Alert (v ... )
271269}
272270
273271// Alertf logs an alert log entry with formatting
274272func Alertf (s string , v ... interface {}) {
275- e := newEntryWithFields ( logFields )
273+ e := newEntry ( )
276274 e .Alertf (s , v ... )
277275}
278276
279277// Fatal logs a fatal log entry
280278func Fatal (v ... interface {}) {
281- e := newEntryWithFields ( logFields )
279+ e := newEntry ( )
282280 e .Fatal (v ... )
283281}
284282
285283// Fatalf logs a fatal log entry with formatting
286284func Fatalf (s string , v ... interface {}) {
287- e := newEntryWithFields ( logFields )
285+ e := newEntry ( )
288286 e .Fatalf (s , v ... )
289287}
290288
291289// Error logs an error log entry
292290func Error (v ... interface {}) {
293- e := newEntryWithFields ( logFields )
291+ e := newEntry ( )
294292 e .Error (v ... )
295293}
296294
297295// Errorf logs an error log entry with formatting
298296func Errorf (s string , v ... interface {}) {
299- e := newEntryWithFields ( logFields )
297+ e := newEntry ( )
300298 e .Errorf (s , v ... )
301299}
302300
0 commit comments