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

Function formatValue

log/log.go:226–232  ·  view source on GitHub ↗

formatValue ensures that the stringified value is valid for use in a Splunk-style K=V format. It quotes the string value if delimeter or quoter characters are present in the value string.

(v interface{})

Source from the content-addressed store, hash-verified

224// Splunk-style K=V format. It quotes the string value if delimeter or quoter
225// characters are present in the value string.
226func formatValue(v interface{}) string {
227 s := fmt.Sprint(v)
228 if strings.ContainsAny(s, pairDelims) {
229 return strconv.Quote(s)
230 }
231 return s
232}
233
234// RecoverAndLogError must be used inside a defer.
235func RecoverAndLogError(ctx context.Context) {

Callers 3

TestFormatValueFunction · 0.85
appendPrefixFunction · 0.85
PrintkvFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatValueFunction · 0.68