tlog.app/go/tlog@v0.23.1/examples/simplest/main.go (about) 1 package main 2 3 import ( 4 "context" 5 "flag" 6 7 "tlog.app/go/tlog" 8 "tlog.app/go/tlog/examples/simplest/sub" 9 ) 10 11 var ( 12 f = flag.Int("f", 1, "int flag") 13 str = flag.String("str", "two", "string flag") 14 ) 15 16 func main() { 17 flag.Parse() 18 19 tlog.Printf("main: %d %q", *f, *str) 20 21 work(context.Background()) 22 } 23 24 func work(ctx context.Context) { 25 tr := tlog.Start("work_name") 26 defer tr.Finish() 27 28 ctx = tlog.ContextWithSpan(ctx, tr) 29 30 sub.Func(ctx, 9) 31 }