go-simpler / sloglint

🪵 Ensure consistent code style when using log/slog
https://go-simpler.org/sloglint
Mozilla Public License 2.0
75 stars 5 forks source link

Add an option to disallow the usage of default logger #30

Closed AlekSi closed 3 months ago

AlekSi commented 4 months ago

So, for example, slog.Info would be forbidden, but l := slog.New(…); l.Info would be allowed.

tmzane commented 4 months ago

Good idea!

I think disallowing global loggers in general might be a useful option, so we could implement it as something like no-global: all (forbid global loggers) and no-global: default (forbid the default logger). WDYT?

AlekSi commented 4 months ago

Sounds great!

tmzane commented 3 months ago

@AlekSi Implemented as discussed. Will probably land in the next golangci-lint release 👀