Skip to content

grpc/backchannel: Simplify logging with yamux

Patrick Steinhardt requested to merge pks-log-yamux into master

We're currently passing in an io.WriteCloser() to Yamux that is then being used as logger. This has the consequence that we're quite tied to the actual implementation of the logger because WriterLevel() is not something that's typically available in other logging libraries. But more importantly, it means that all log messages are now written at the error level, which isn't quite what we want.

The current setup is actually a limitation of the Yamux package itself: we can either pass in a log writer, or a log.Logger. We don't really want either though. This limitation has been fixed upstream via 13a7bc0 (Fix hashicorp/yamux#72, abstract logger into interface, 2019-04-15), which converts starts to accept an interface instead of a log.Logger. The library didn't release a new version since then though, and given that this is change has been implemented four years ago, it seems quite unlikely that a new release will be created soonish. That being said though, upgrading to that unstable version should be fine as the only change between our current v0.1.1 and that commit is the change to use that logger interface.

Let's upgrade Yamux to the version including this change and refactor our code to pass the logrus.FieldLogger directly instead of passing an io.Writer.

Merge request reports