Web presence of Neil O'Toole.


Go 1.21 has a new structured logger in stdlib: slog. I’ve been using the slog pre-releases in my projects for many months. While there’s still a bit of a debate about the merits of its API, slog checks enough boxes that it will become the standard. This eliminates a major hassle for Go developers: needing to add bridges to various logging packages in order to get a unified logging experience.

It also means I can formally retire my lg experiment.

One aspect that the Go team have strangely neglected is that there’s no bridge between slog and the stdlib testing package. I created the slogt package as that bridge. Hopefully something like this will one day be incorporated into stdlib, and I can then retire slogt.

UPDATE 2024-03-15: I was recently looking through the docs for riverqueue, which is a Postgres-backed job queue for Go that I was investigating, and I saw this:


It’s gratifying to see that I’m not the only one who cares about correlating logs with tests!