4 ms·
Slogtest
- ming13 3y agoA thing I appreciate about Go — there are such testing-scoped packages built-in. As I’ve experienced, this approach encourages a good testing culture in teams.
- zknill 3y agoThe new structured logging library is a great addition, its nice to have structured logging in the standard lib. It's easy to get started with log/slog and one of the built in handlers, but as soon as you want to change something the library design pushes you towards implementing an entire handler. For example, if I was the built in JSON format, but with a different formatting of the Time field, that's not easy to do. It's not obvious how to change the built in handler. I wrote slogmw[1] to solve this problem. It's a set of middleware and examples that make it easy to make small changes to the built in handlers without having to write a whole new handler from scratch. [1] https://github.com/zknill/slogmw https://github.com/zknill/slogmw