5 ms·
> At boundaries between our code and calls out to external packages, make an effort to always wrap the result with xerrors.Errorf. This ensures that we always c
by mozey 5y ago
> At boundaries between our code and calls out to external packages, make an effort to always wrap the result with xerrors.Errorf. This ensures that we always capture a stack trace at the most proximate location of an error being generated as possible
I've been doing something similar for a while, using `errors.WithStack` from https://github.com/pkg/errors https://github.com/pkg/errors
The error can then be logged with https://github.com/rs/zerolog https://github.com/rs/zerolog like this `log.Error().Stack().Err(err).Msg("")`
For human readable output (instead of the standard JSON) use a console writer, see https://github.com/mozey/logutil https://github.com/mozey/logutil