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

Function fieldsToMap

framework/log/log.go:151–169  ·  view source on GitHub ↗
(fields []interface{}, out map[string]interface{})

Source from the content-addressed store, hash-verified

149}
150
151func fieldsToMap(fields []interface{}, out map[string]interface{}) {
152 var lastKey string
153 for i, val := range fields {
154 if i%2 == 0 {
155 // Key
156 key, ok := val.(string)
157 if !ok {
158 // Misformatted arguments, attempt to provide useful message
159 // anyway.
160 out[fmt.Sprint("field", i)] = key
161 continue
162 }
163 lastKey = key
164 } else {
165 // Value
166 out[lastKey] = val
167 }
168 }
169}
170
171func (l *Logger) formatMsg(msg string, fields map[string]interface{}) string {
172 formatted := strings.Builder{}

Callers 3

MsgMethod · 0.85
ErrorMethod · 0.85
DebugMsgMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected