Skip to content

log: Unify setup of the logging interceptors

Patrick Steinhardt requested to merge pks-log-self-contained-middleware into master

Constructing the logging interceptors is quite involved and requires the caller to set up multiple different structures. Besides being hard to understand, it also requires us to expose the fact that we're using the logrus go-grpc-middleware to our callers.

Refactor the code to unify all of the plumbing into the logger itself. All the caller needs to pass in now is any additional fields producers they wish to install, but other than that things are self-contained. As this change requires the need to pass in the logrus message producer, it ensures that we can install non-logrus loggers as interceptors.

Note that this requires us to change some of our tests to also install the log.PerRPCLogHandler. This is required because our own logging interceptor plays some games with the log message such that it can also include gRPC statistics and thus defers writing the log message to a later point. This late rpoint is the per-RPC log handler, which thus becomes mandatory in order to observe any log messages.

Merge request reports