github.com/gogf/gf@v1.16.9/.example/os/glog/glog_CtxKeys.go (about) 1 package main 2 3 import ( 4 "context" 5 "github.com/gogf/gf/frame/g" 6 ) 7 8 func main() { 9 g.Log().SetCtxKeys("TraceId", "SpanId", "Test") 10 ctx := context.WithValue(context.Background(), "TraceId", "1234567890") 11 ctx = context.WithValue(ctx, "SpanId", "abcdefg") 12 13 g.Log().Ctx(ctx).Print(1, 2, 3) 14 }