▲ | sveinnthorarins 2 days ago | |
Cool article. I really like structured logs and am pleased the Go team saw the benefits of bringing it into the standard library. However, I feel like errors should be able to hold slog attributes. It makes for some very useful and easy error logging, especially when the logging takes place far up the execution chain from where the error happened. This is easily possible with a custom error type and some log functions. I have published on GitHub my small and crude implementation that I use in a few hobby projects, MIT licensed, if anyone is interested. https://github.com/sveinnthorarins/sterlo |