package serialize
import "k8s.io/klog/v2/internal/serialize"
Index ¶
- func ErrorToString(err error) (ret string)
- func FormatKVs(b *bytes.Buffer, kvs ...[]interface{})
- func MarshalerToValue(m logr.Marshaler) (ret interface{})
- func StringerToString(s fmt.Stringer) (ret string)
- func WithValues(oldKV, newKV []interface{}) []interface{}
- type AnyToStringFunc
- type Formatter
Functions ¶
func ErrorToString ¶
ErrorToString converts an error to a string, handling panics if they occur.
func FormatKVs ¶
func MarshalerToValue ¶
MarshalerToValue invokes a marshaler and catches panics.
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.
Types ¶
type AnyToStringFunc ¶
type AnyToStringFunc func(v interface{}) string
type Formatter ¶
type Formatter struct {
AnyToStringHook AnyToStringFunc
}
func (Formatter) FormatKVs ¶
FormatKVs formats all key/value pairs such that the output contains no duplicates ("last one wins").
func (Formatter) KVFormat ¶
KVFormat serializes one key/value pair into the provided buffer. A space gets inserted before the pair. It returns the key.
Source Files ¶
keyvalues.go keyvalues_slog.go
- Version
- v2.140.0 (latest)
- Published
- Mar 3, 2026
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 6 hours ago –
Tools for package owners.