package recovery

import (
	
	

	
	
)

// Do is a function wrapper that will recover from a panic and return the error.
// Optionally it takes a logger to log the stack trace. Note that it only logs to a single logger.
func ( func() error,  ...log.Logger) func() error {
	return func() ( error) {
		defer func() {
			if  := recover();  != nil {
				switch e := .(type) {
				case error:
					 = 
				case string:
					 = fmt.Errorf("%v", )
				}
				if len() > 0 {
					level.Error([0]).Log("msg", "recovered from panic", "err", , "stacktrace", string(debug.Stack()))
				}
			}
		}()
		return ()
	}
}