I've been having a real struggle with gRPC-go and being so verbose and know they plan to add different verbosity levels - however has anyone else experienced this and come up with a reasonable solution?
I am mostly referring to how when you call something to the nature of:
client.Close()
causes the server to log:
transport: http2Server.HandleStreams failed to read frame: read tcp 127.0.0.1:50001->127.0.0.1:50829: read: connection reset by peer
on what appears to be exponential back-off.
评论:
schumacherfm:
nastus:Build your own log wrapper and add it like:
grpclog.SetLogger(grpcLogTestWrap{})
I'm using that pattern while testing gRPC backends for an ESI tag middleware.
I also hate their global logger. Terrible pattern for a library.
pbo_:Thanks!
nastus:You can set your own gRPC logger using:
google.golang.org/grpc/grpclog.SetLogger()
But be aware that it must be called from init() functions only.
You can check out etcd sources to see how CoreOS guys have overcome this limitation: https://github.com/coreos/etcd/blob/master/clientv3/logger.go
That's a good real world example, thanks :)
