File tree 1 file changed +5
-15
lines changed
1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change 20
20
L = logrus .NewEntry (logrus .StandardLogger ())
21
21
)
22
22
23
- var (
24
- logWithTraceID = false
25
- )
26
-
27
- func EnableLogWithTraceID (b bool ) {
28
- logWithTraceID = b
29
- }
30
-
31
23
type (
32
24
loggerKey struct {}
33
25
)
@@ -51,13 +43,11 @@ func GetLogger(ctx context.Context) (l *logrus.Entry) {
51
43
l = L
52
44
}
53
45
54
- if logWithTraceID {
55
- if spanContext := trace .SpanFromContext (ctx ).SpanContext (); spanContext .IsValid () {
56
- return l .WithFields (logrus.Fields {
57
- "traceID" : spanContext .TraceID (),
58
- "spanID" : spanContext .SpanID (),
59
- })
60
- }
46
+ if spanContext := trace .SpanFromContext (ctx ).SpanContext (); spanContext .IsValid () {
47
+ return l .WithFields (logrus.Fields {
48
+ "traceID" : spanContext .TraceID (),
49
+ "spanID" : spanContext .SpanID (),
50
+ })
61
51
}
62
52
63
53
return l
You can’t perform that action at this time.
0 commit comments