|
|
|
|
|
by jupp0r
1036 days ago
|
|
I think Uber chose a better approach for their Go logging library called Zap [1] logger.Info("failed to fetch URL",
// Structured context as strongly typed Field values.
zap.String("url", url),
zap.Int("attempt", 3),
zap.Duration("backoff", time.Second),
)
They also have zap.Error(err) which generates the "error" key as a convention.[1] https://github.com/uber-go/zap |
|
For example: https://pkg.go.dev/golang.org/x/exp/slog#example-Group