From 9438c484de9ace3bc14a464b63d3da3e5f2ffa98 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Fri, 30 Oct 2020 23:57:35 -0400 Subject: [PATCH] Add optional panic data for PanicSafe --- loggy.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/loggy.go b/loggy.go index ecd8b6f..11d14e7 100644 --- a/loggy.go +++ b/loggy.go @@ -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...) } }