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

Function formatKey

log/log.go:210–221  ·  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

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