MCPcopy Create free account
hub / github.com/develar/app-builder / encodeExtraFields

Method encodeExtraFields

pkg/zap-cli-encoder/consoleEncoder.go:215–233  ·  view source on GitHub ↗
(levelColor uint8, fieldNameAndValueList *[]*buffer.Buffer)

Source from the content-addressed store, hash-verified

213}
214
215func (t *consoleEncoder) encodeExtraFields(levelColor uint8, fieldNameAndValueList *[]*buffer.Buffer) int {
216 addedLength := 0
217 for index, key := range t.fieldNames {
218 v := t.fieldValues[index]
219 addedLength += len(key) + 1 + len(v)
220
221 buf := linePool.Get()
222 if t.colored {
223 _, _ = fmt.Fprintf(buf, "\x1b[%dm%s\x1b[0m", levelColor, key)
224 } else {
225 buf.AppendString(key)
226 }
227 buf.AppendString("=")
228 _, _ = buf.Write(v)
229
230 (*fieldNameAndValueList)[index] = buf
231 }
232 return addedLength
233}
234
235func getLevelColorAndIndicator(entry *zapcore.Entry) (uint8, string) {
236 var levelColor uint8

Callers 1

EncodeEntryMethod · 0.95

Calls 1

AppendStringMethod · 0.80

Tested by

no test coverage detected