log: Introduce and use `NewLogMatcher`
We use log.DeciderOption
to obtain a grpcmwlogrus.Option
which is used to only apply logs to certain grpc methods. This option is no longer available in 'go-grpc-middleware@v2'.
To overcome this we introduce and use log.NewLogMatcher
which satisfies the Matcher
interface within 'go-grpc-middleware@v2' and then use this along with the selector.*ServerInterceptor
to provide the same functionality.
We also deprecate the old code and use the new code, along with the tests. This provides a good opportunity to introduce a mock 'slog' to be used as an implementation of log.Logger
in tests.
Part of #5405 (closed), #5661
Edited by Karthik Nayak