File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change 2020 L = logrus .NewEntry (logrus .StandardLogger ())
2121)
2222
23- var (
24- logWithTraceID = false
25- )
26-
27- func EnableLogWithTraceID (b bool ) {
28- logWithTraceID = b
29- }
30-
3123type (
3224 loggerKey struct {}
3325)
@@ -51,13 +43,11 @@ func GetLogger(ctx context.Context) (l *logrus.Entry) {
5143 l = L
5244 }
5345
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+ })
6151 }
6252
6353 return l
You can’t perform that action at this time.
0 commit comments