Files
kematianc2/Kematian-Standalone/native/recovery/log.go
T
2026-08-27 11:23:01 -06:00

27 lines
494 B
Go

package recovery
import (
"fmt"
"log"
"sync"
)
func logf(format string, args ...interface{}) {
log.Printf("[recovery] "+format, args...)
}
func safeRecover(where string) {
if r := recover(); r != nil {
logf("panic recovered in %s: %v", where, r)
}
}
func recoverErrors(where string, errs *[]string, mu *sync.Mutex) {
if r := recover(); r != nil {
logf("panic recovered in %s: %v", where, r)
mu.Lock()
*errs = append(*errs, fmt.Sprintf("%s: %v", where, r))
mu.Unlock()
}
}