appendValue appends a value to the buffer, applying quoting rules as necessary.
(val slog.Value, forceQuote bool)
| 64 | |
| 65 | // appendValue appends a value to the buffer, applying quoting rules as necessary. |
| 66 | func (s *formatterCommon) appendValue(val slog.Value, forceQuote bool) { |
| 67 | switch val.Kind() { |
| 68 | case slog.KindString: |
| 69 | s.appendString(val.String(), forceQuote) |
| 70 | case slog.KindInt64: |
| 71 | s.buf.appendInt(val.Int64()) |
| 72 | case slog.KindUint64: |
| 73 | s.buf.appendUint(val.Uint64()) |
| 74 | case slog.KindFloat64: |
| 75 | s.buf.appendFloat(val.Float64()) |
| 76 | case slog.KindBool: |
| 77 | s.buf.appendBool(val.Bool()) |
| 78 | case slog.KindDuration: |
| 79 | s.appendString(val.Duration().String(), forceQuote) |
| 80 | case slog.KindTime: |
| 81 | s.appendTime(val.Time()) |
| 82 | default: |
| 83 | s.appendAny(val.Any(), forceQuote) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // appendString appends a string value to the buffer, applying quoting rules as necessary. |
| 88 | func (s *formatterCommon) appendString(val string, forceQuote bool) { |
nothing calls this directly
no test coverage detected