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{})
| 209 | // Splunk-style K=V format. It stubs out delimeter and quoter characters in |
| 210 | // the key string with hyphens. |
| 211 | func 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 |
no outgoing calls