mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
Log the stack trace and recover object (#923)
* Log the stack trace and recover object * Remove stderr log
This commit is contained in:
parent
3d501975e4
commit
696f5c68f4
1 changed files with 8 additions and 2 deletions
|
@ -18,7 +18,10 @@ func Recover(ctx context.Context) {
|
|||
if eventID := sentry.CurrentHub().Recover(err); eventID != nil {
|
||||
ctx.Logger().Info("panic captured", "event_id", *eventID)
|
||||
}
|
||||
fmt.Fprint(os.Stderr, panicStack)
|
||||
ctx.Logger().Error(fmt.Errorf("panic"), "recovered from panic",
|
||||
"stack-trace", panicStack,
|
||||
"recover", err,
|
||||
)
|
||||
if !sentry.Flush(time.Second * 5) {
|
||||
ctx.Logger().Info("sentry flush failed")
|
||||
}
|
||||
|
@ -32,7 +35,10 @@ func RecoverWithExit(ctx context.Context) {
|
|||
if eventID := sentry.CurrentHub().Recover(err); eventID != nil {
|
||||
ctx.Logger().Info("panic captured", "event_id", *eventID)
|
||||
}
|
||||
fmt.Fprint(os.Stderr, panicStack)
|
||||
ctx.Logger().Error(fmt.Errorf("panic"), "recovered from panic before exiting",
|
||||
"stack-trace", panicStack,
|
||||
"recover", err,
|
||||
)
|
||||
if !sentry.Flush(time.Second * 5) {
|
||||
ctx.Logger().Info("sentry flush failed")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue