Interceptors not compatible with log/slog.Default()
Author: simone-dimaulo-hsCreated Dec 19, 2024Updated Mar 18, 2026
The current implementation is not compatible with the std library log/slog package
https://github.com/grpc-ecosystem/go-grpc-middleware/blob/main/interceptors/logging/logging.go#L188-L196
The compiler error is
have Log(context.Context, slog.Level, string, ...any)
want Log(context.Context, logging.Level, string, ...any)Go version used: any version from 1.21
What happened:
It's not possible to inject the slog.Default() logger to the interceptor
What you expected to happen: I'd like to be able to use the std slog logger
Any plan to be compatible with slog/log ?
Source: grpc-ecosystem/go-grpc-middleware