Skip to content

Commit

Permalink
wapp: emit event.2 event when recovering panic (#47)
Browse files Browse the repository at this point in the history
Fixes #46

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/palantir/witchcraft-go-logging/47)
<!-- Reviewable:end -->
  • Loading branch information
bmoylan authored Apr 16, 2019
1 parent 6b96781 commit 20c7378
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wlog/wapp/fatal.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/palantir/witchcraft-go-error"
"github.com/palantir/witchcraft-go-logging/wlog/diaglog/diag1log"
"github.com/palantir/witchcraft-go-logging/wlog/evtlog/evt2log"
"github.com/palantir/witchcraft-go-logging/wlog/svclog/svc1log"
)

Expand Down Expand Up @@ -50,6 +51,11 @@ func RunWithFatalLogging(ctx context.Context, runFn func(ctx context.Context) er
werror.UnsafeParam("recovered", r))
}
}
if evtlog := evt2log.FromContext(ctx); evtlog != nil {
evtlog.Event("wapp.panic_recovered",
evt2log.Value("stacktrace", stacktrace),
evt2log.UnsafeParam("recovered", r))
}
}()
if err := runFn(ctx); err != nil {
svc1log.FromContext(ctx).Error("error", svc1log.Stacktrace(err))
Expand Down

0 comments on commit 20c7378

Please sign in to comment.