MCPcopy
hub / github.com/go-kit/kit / Log

Method Log

log/logrus/logrus_logger.go:43–69  ·  view source on GitHub ↗
(keyvals ...interface{})

Source from the content-addressed store, hash-verified

41}
42
43func (l Logger) Log(keyvals ...interface{}) error {
44 fields := logrus.Fields{}
45 for i := 0; i < len(keyvals); i += 2 {
46 if i+1 < len(keyvals) {
47 fields[fmt.Sprint(keyvals[i])] = keyvals[i+1]
48 } else {
49 fields[fmt.Sprint(keyvals[i])] = errMissingValue
50 }
51 }
52
53 switch l.level {
54 case logrus.InfoLevel:
55 l.field.WithFields(fields).Info()
56 case logrus.ErrorLevel:
57 l.field.WithFields(fields).Error()
58 case logrus.DebugLevel:
59 l.field.WithFields(fields).Debug()
60 case logrus.WarnLevel:
61 l.field.WithFields(fields).Warn()
62 case logrus.TraceLevel:
63 l.field.WithFields(fields).Trace()
64 default:
65 l.field.WithFields(fields).Print()
66 }
67
68 return nil
69}

Callers 15

TestLogrusLoggerFunction · 0.95
TestWithLevelFunction · 0.95
erfinvFunction · 0.45
WriteLoopMethod · 0.45
WriteLoopMethod · 0.45
WriteLoopMethod · 0.45
WriteLoopMethod · 0.45
WriteLoopMethod · 0.45
WriteLoopMethod · 0.45
WriteLoopMethod · 0.45

Calls 5

InfoMethod · 0.80
DebugMethod · 0.80
WarnMethod · 0.80
PrintMethod · 0.80
ErrorMethod · 0.45

Tested by 15

TestLogrusLoggerFunction · 0.76
TestWithLevelFunction · 0.76
TestNewRegistarFunction · 0.36
TestNewRegistarFunction · 0.36
runIntegrationFunction · 0.36
Example_basicFunction · 0.36
Example_contextualFunction · 0.36
Example_valuerFunction · 0.36
Example_debugInfoFunction · 0.36