add labels to logged errors (#2824)
#### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup
This commit is contained in:
parent
c47ee74837
commit
8b1c3a7073
@ -284,7 +284,9 @@ func Ctx(ctx context.Context) *zap.SugaredLogger {
|
|||||||
// and packs all of the structured data in the error inside it.
|
// and packs all of the structured data in the error inside it.
|
||||||
func CtxErr(ctx context.Context, err error) *zap.SugaredLogger {
|
func CtxErr(ctx context.Context, err error) *zap.SugaredLogger {
|
||||||
return Ctx(ctx).
|
return Ctx(ctx).
|
||||||
With("error", err).
|
With(
|
||||||
|
"error", err,
|
||||||
|
"error_labels", clues.Labels(err)).
|
||||||
With(clues.InErr(err).Slice()...)
|
With(clues.InErr(err).Slice()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user