MCPcopy Create free account
hub / github.com/chain/Core / formatKey

Function formatKey

log/log.go:211–222  ·  view source on GitHub ↗

formatKey ensures that the stringified key is valid for use in a Splunk-style K=V format. It stubs out delimeter and quoter characters in the key string with hyphens.

(k interface{})

Source from the content-addressed store, hash-verified

209// Splunk-style K=V format. It stubs out delimeter and quoter characters in
210// the key string with hyphens.
211func formatKey(k interface{}) string {
212 s := fmt.Sprint(k)
213 if s == "" {
214 return "?"
215 }
216
217 for _, c := range illegalKeyChars {
218 s = strings.Replace(s, string(c), "-", -1)
219 }
220
221 return s
222}
223
224// formatValue ensures that the stringified value is valid for use in a
225// Splunk-style K=V format. It quotes the string value if delimeter or quoter

Callers 3

TestFormatKeyFunction · 0.85
appendPrefixFunction · 0.85
PrintkvFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatKeyFunction · 0.68