Explorar el Código

printing context key friendly

kevin hace 4 años
padre
commit
dc17855367
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  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)
+}