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

Simplify the Logger interface #80

Open
matthewmueller opened this issue Dec 22, 2024 · 0 comments
Open

Simplify the Logger interface #80

matthewmueller opened this issue Dec 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@matthewmueller
Copy link

matthewmueller commented Dec 22, 2024

Is your feature request related to a problem? Please describe.

Hey there, thanks for modernizing this library!

Currently the Logger interface looks like this:

type logger interface {
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Fatalln(v ...interface{})
	Panic(v ...interface{})
	Panicf(format string, v ...interface{})
	Panicln(v ...interface{})
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

But the library itself only uses Printf. Since this interface isn't compatible with the new *slog.Logger it requires wrapping.

Ideally, we wouldn't have to wrap all these methods, just the ones that the library uses

Describe the solution you'd like
A clear and concise description of what you want to happen.

I'd suggest reducing the Logger interface to what's necessary:

type logger interface {
  Printf(format string, v ...interface{})
}

And perhaps any other methods to future-proof it (seems like there's another issue to log errors).

Describe alternatives you've considered
Current alternative is to wrap it.

@matthewmueller matthewmueller added the enhancement New feature or request label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant