Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interceptors not compatible with log/slog.Default() #738

Open
simone-dimaulo-hs opened this issue Dec 19, 2024 · 1 comment
Open

Interceptors not compatible with log/slog.Default() #738

simone-dimaulo-hs opened this issue Dec 19, 2024 · 1 comment

Comments

@simone-dimaulo-hs
Copy link

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 ?

@johanbrandhorst
Copy link
Collaborator

According to

// TODO(bwplotka): Once slog is official, we could use slog method directly. Currently level is copied over, so we don't
// depend on experimental module.

We always intended to use the slog logging level when it became available. Would you be able to contribute a fix to switch us to using the slog log level? It's a somewhat breaking change but I think it's understandable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants