소스 검색

printing context key friendly

kevin 4 년 전
부모
커밋
dc17855367
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      core/trace/tracespec/vars.go

+ 7 - 2
core/trace/tracespec/vars.go

@@ -1,7 +1,12 @@
 package tracespec
 
+// TracingKey is tracing key for context
+var TracingKey = contextKey("X-Trace")
+
 // contextKey a type for context key
 type contextKey string
 
-// TracingKey is tracing key for context
-var TracingKey = contextKey("X-Trace")
+// Printing a context will reveal a fair amount of information about it.
+func (c contextKey) String() string {
+	return "trace/tracespec context key " + string(c)
+}