package serialize
import "k8s.io/klog/v2/internal/serialize"
Index ¶
- func ErrorToString(err error) (ret string)
- func KVListFormat(b *bytes.Buffer, keysAndValues ...interface{})
- func MarshalerToValue(m logr.Marshaler) (ret interface{})
- func MergeKVs(first, second []interface{}) []interface{}
- func StringerToString(s fmt.Stringer) (ret string)
- func WithValues(oldKV, newKV []interface{}) []interface{}
Functions ¶
func ErrorToString ¶
ErrorToString converts an error to a string, handling panics if they occur.
func KVListFormat ¶
KVListFormat serializes all key/value pairs into the provided buffer. A space gets inserted before the first pair and between each pair.
func MarshalerToValue ¶
MarshalerToValue invokes a marshaler and catches panics.
func MergeKVs ¶
func MergeKVs(first, second []interface{}) []interface{}
MergeKVs deduplicates elements provided in two key/value slices.
Keys in each slice are expected to be unique, so duplicates can only occur when the first and second slice contain the same key. When that happens, the key/value pair from the second slice is used. The first slice must be well-formed (= even key/value pairs). The second one may have a missing value, in which case the special "missing value" is added to the result.
func StringerToString ¶
StringerToString converts a Stringer to a string, handling panics if they occur.
func WithValues ¶
func WithValues(oldKV, newKV []interface{}) []interface{}
WithValues implements LogSink.WithValues. The old key/value pairs are assumed to be well-formed, the new ones are checked and padded if necessary. It returns a new slice.
Source Files ¶
keyvalues.go
- Version
- v2.70.1
- Published
- Jul 7, 2022
- Platform
- darwin/amd64
- Imports
- 4 packages
- Last checked
- 17 hours ago –
Tools for package owners.