1
0
mirror of https://github.com/Rudi9719/loggy.git synced 2026-03-21 21:07:24 +00:00

Add optional panic data for PanicSafe

This commit is contained in:
2020-10-30 23:57:35 -04:00
parent 35d9b032ab
commit 9438c484de

View File

@ -213,9 +213,10 @@ func (l Logger) LogMsg(msg Log) {
}
// PanicSafe is a deferrable function to recover from a panic operation.
func (l Logger) PanicSafe() {
func (l Logger) PanicSafe(a ...interface{}) {
if r := recover(); r != nil {
l.LogCritical(fmt.Sprintf("Panic detected: %+v", r))
l.LogCritical("Panic detected: %+v", r)
l.LogCritical("Optional panic data: %+v", a...)
}
}