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{})
| 224 | // Splunk-style K=V format. It quotes the string value if delimeter or quoter |
| 225 | // characters are present in the value string. |
| 226 | func 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. |
| 235 | func RecoverAndLogError(ctx context.Context) { |
no outgoing calls