mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
29 lines
493 B
Go
29 lines
493 B
Go
package debug
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/common/dbg"
|
|
"github.com/ledgerwatch/log/v3"
|
|
)
|
|
|
|
var sigc chan os.Signal
|
|
|
|
func GetSigC(sig *chan os.Signal) {
|
|
sigc = *sig
|
|
}
|
|
|
|
// LogPanic - does log panic to logger and to <datadir>/crashreports then stops the process
|
|
func LogPanic() {
|
|
panicResult := recover()
|
|
if panicResult == nil {
|
|
return
|
|
}
|
|
|
|
log.Error("catch panic", "err", panicResult, "stack", dbg.Stack())
|
|
if sigc != nil {
|
|
sigc <- syscall.SIGINT
|
|
}
|
|
}
|