Skip to content

Commit

Permalink
Add common message to panic logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sp-jordi-forns committed Oct 27, 2023
1 parent d0275db commit d420c1f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion recovery/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ func Handler(l logx.Logger, opts ...Options) func() {

return func() {
if r := recover(); r != nil {
l.Error(fmt.Sprintf("%v", r), logx.F("stack_trace", strings.Split(string(debug.Stack()), "\n")))
l.Error(
fmt.Sprintf("go panic recovered: %v", r),
logx.F("ctx_stack_trace", strings.Split(string(debug.Stack()), "\n")),
)
o.exitFunc()
}
}
Expand Down

0 comments on commit d420c1f

Please sign in to comment.