MCPcopy
hub / github.com/sirupsen/logrus / WithField

Function WithField

exported.go:69–71  ·  view source on GitHub ↗

WithField creates an entry from the standard logger and adds a field to it. If you want multiple fields, use `WithFields`. Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

(key string, value interface{})

Source from the content-addressed store, hash-verified

67// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
68// or Panic on the Entry it returns.
69func WithField(key string, value interface{}) *Entry {
70 return std.WithField(key, value)
71}
72
73// WithFields creates an entry from the standard logger and adds multiple
74// fields to it. This is simply a helper for `WithField`, invoking it

Callers 15

TestErrorNotLostFunction · 0.85
TestFieldClashWithTimeFunction · 0.85
TestFieldClashWithMsgFunction · 0.85
TestFieldClashWithLevelFunction · 0.85
TestJSONLevelKeyFunction · 0.85
TestJSONTimeKeyFunction · 0.85
TestFieldClashWithCallerFunction · 0.85
TestJSONDisableTimestampFunction · 0.85
TestJSONEnableTimestampFunction · 0.85

Calls 1

WithFieldMethod · 0.65

Tested by 15

TestErrorNotLostFunction · 0.68
TestFieldClashWithTimeFunction · 0.68
TestFieldClashWithMsgFunction · 0.68
TestFieldClashWithLevelFunction · 0.68
TestJSONLevelKeyFunction · 0.68
TestJSONTimeKeyFunction · 0.68
TestFieldClashWithCallerFunction · 0.68
TestJSONDisableTimestampFunction · 0.68
TestJSONEnableTimestampFunction · 0.68