package log

import (
	
	
)

// InterleavedKVToFields converts keyValues a la Span.LogKV() to a Field slice
// a la Span.LogFields().
func ( ...interface{}) ([]Field, error) {
	if len()%2 != 0 {
		return nil, fmt.Errorf("non-even keyValues len: %d", len())
	}
	 := make([]Field, len()/2)
	for  := 0; *2 < len(); ++ {
		,  := [*2].(string)
		if ! {
			return nil, fmt.Errorf(
				"non-string key (pair #%d): %T",
				, [*2])
		}
		switch typedVal := [*2+1].(type) {
		case bool:
			[] = Bool(, )
		case string:
			[] = String(, )
		case int:
			[] = Int(, )
		case int8:
			[] = Int32(, int32())
		case int16:
			[] = Int32(, int32())
		case int32:
			[] = Int32(, )
		case int64:
			[] = Int64(, )
		case uint:
			[] = Uint64(, uint64())
		case uint64:
			[] = Uint64(, )
		case uint8:
			[] = Uint32(, uint32())
		case uint16:
			[] = Uint32(, uint32())
		case uint32:
			[] = Uint32(, )
		case float32:
			[] = Float32(, )
		case float64:
			[] = Float64(, )
		default:
			if  == nil || (reflect.ValueOf().Kind() == reflect.Ptr && reflect.ValueOf().IsNil()) {
				[] = String(, "nil")
				continue
			}
			// When in doubt, coerce to a string
			[] = String(, fmt.Sprint())
		}
	}
	return , nil
}