News for hackers. Stuff that matters.
Re:Logging in Go with Slog: A Practitioner's Guide by peterldowns on Friday September 12, 2025 @11:03AM (#45222898)
1) Right, but this is complicated and annoying. Imagine a world where you could just pass your existing logger in, because my library references an interface like `stdlib/logging.GenericLoggerInterface` and slog, zap, zerolog, etc. all implement that! Would be nice!

2) TIL about `T.Output`, thank you, that's great to know about. Still annoying and would be nice if the slog package showed an example of logging from tests with correct callsites. Golang gets so many things right about testing, so the fact that logging in tests is difficult really stands out and bothers me.

Re:Logging in Go with Slog: A Practitioner's Guide by phyrog on Friday September 12, 2025 @11:57AM (#45223565)
But that is exactly what slog provides? The a unified interface that can be implemented by other logger libraries. Yes the Logger itself is not the interface, but the Handler it is backed by is.