WingNews logo WingNews
top | new | best | ask | show | jobs
top | item 44150105

(no title)

gregwebs | 9 months ago

There are several existing Go error libraries with a similar approach sans context.

The approach I ended up taking is to use slog attributes. It allows for reuse of existing logging attributes.

This is explained here (skip to the “adding metadata” portion). https://blog.gregweber.info/blog/go-errors-library/

Go package: https://pkg.go.dev/github.com/gregwebs/errors/slogerr

discuss

order

No comments yet.

powered by hn/api // news.ycombinator.com