...
1 package ctxkit_test
2
3 import (
4 "context"
5
6 "github.com/grpc-ecosystem/go-grpc-middleware/logging/kit/ctxkit"
7 grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
8 pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto"
9 )
10
11
12 func ExampleExtract_unary() {
13 _ = func(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.PingResponse, error) {
14
15 grpc_ctxtags.Extract(ctx).Set("custom_tags.string", "something").Set("custom_tags.int", 1337)
16
17
18 l := ctxkit.Extract(ctx)
19 l.Log("msg", "some ping")
20 l.Log("msg", "another ping")
21 return &pb_testproto.PingResponse{Value: ping.Value}, nil
22 }
23 }
24
View as plain text