(levelColor uint8, fieldNameAndValueList *[]*buffer.Buffer)
| 213 | } |
| 214 | |
| 215 | func (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 | |
| 235 | func getLevelColorAndIndicator(entry *zapcore.Entry) (uint8, string) { |
| 236 | var levelColor uint8 |
no test coverage detected