MCPcopy Index your code
hub / github.com/foxcpp/maddy / Error

Method Error

framework/log/log.go:121–140  ·  view source on GitHub ↗

Error writes an event log message in a machine-readable format (currently JSON) containing information about the error. If err does have a Fields method that returns map[string]interface{}, its result will be added to the message. name: msg\t{"key":"value","key2":"value2"} Additionally, values fr

(msg string, err error, fields ...interface{})

Source from the content-addressed store, hash-verified

119// context in which the error is *handled*. For example, if error leads to
120// rejection of SMTP DATA command, msg will probably be "DATA error".
121func (l *Logger) Error(msg string, err error, fields ...interface{}) {
122 if err == nil {
123 return
124 }
125
126 errFields := exterrors.Fields(err)
127 allFields := make(map[string]interface{}, len(fields)+len(errFields)+2)
128 for k, v := range errFields {
129 allFields[k] = v
130 }
131
132 // If there is already a 'reason' field - use it, it probably
133 // provides a better explanation than error text itself.
134 if allFields["reason"] == nil {
135 allFields["reason"] = err.Error()
136 }
137 fieldsToMap(fields, allFields)
138
139 l.log(false, l.formatMsg(msg, allFields))
140}
141
142func (l *Logger) DebugMsg(kind string, fields ...interface{}) {
143 if !l.IsDebug() {

Callers 15

RunFunction · 0.45
VerifyConfigFunction · 0.45
moduleStopFunction · 0.45
moduleMainFunction · 0.45
moduleReloadFunction · 0.45
StartAllMethod · 0.45
ReloadAllMethod · 0.45
EarlyStopAllMethod · 0.45
StopAllMethod · 0.45
TestFuture_SetBeforeGetFunction · 0.45
TestFuture_WaitFunction · 0.45
marshalOrderedJSONFunction · 0.45

Calls 4

logMethod · 0.95
formatMsgMethod · 0.95
FieldsFunction · 0.92
fieldsToMapFunction · 0.85

Tested by 9

TestFuture_SetBeforeGetFunction · 0.36
TestFuture_WaitFunction · 0.36
TestReadFunction · 0.36
TestMap_CallbackFunction · 0.36
TestDispenser_NextArgFunction · 0.36
TestDispenser_ArgsFunction · 0.36
TestDispenser_ArgErr_ErrFunction · 0.36
TestValidMailboxNameFunction · 0.36
RunMethod · 0.36