khenaidoo | 2672188 | 2021-08-11 17:42:52 -0400 | [diff] [blame] | 1 | package ext |
2 | |||||
3 | import ( | ||||
4 | "github.com/opentracing/opentracing-go" | ||||
5 | "github.com/opentracing/opentracing-go/log" | ||||
6 | ) | ||||
7 | |||||
8 | // LogError sets the error=true tag on the Span and logs err as an "error" event. | ||||
9 | func LogError(span opentracing.Span, err error, fields ...log.Field) { | ||||
10 | Error.Set(span, true) | ||||
11 | ef := []log.Field{ | ||||
12 | log.Event("error"), | ||||
13 | log.Error(err), | ||||
14 | } | ||||
15 | ef = append(ef, fields...) | ||||
16 | span.LogFields(ef...) | ||||
17 | } |