Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
func Handle()
Handle calls registered handlers sequentially according to priority and registration order
Panics caused by handler func will be caught, recorded, then next func will be run
func Register ¶
func Register(eh ExitHandler)
Register registers ExitHandler
Smaller prio number mean higher priority and exit handlers with higher priority will be executed first. For handlers with equal priorities, those registered first will be executed earlier at exit time
Types ¶
type ExitHandler ¶
type ExitHandler struct { Prio Prio Reason string Func ExitHandlerFunc Value interface{} }
ExitHandler defines the spec of handler
Reason and Func are mandatory and must not be empty or nil ¶
Handlers with smaller Prio will be executed earlier than those with bigger Prio at exit time. Handler func will receive a copy of the ExitHandler struct previously registered
type ExitHandlerFunc ¶
type ExitHandlerFunc func(ExitHandler)
ExitHandlerFunc is the type of handler func