Death v3.0 Release Notes

Release Date: 2018-06-27 // over 3 years ago
  • ๐Ÿš€ This release removes all external dependencies to a logger. Now by default death will not log anything but supports using your own custom logger. To use the logger satisfy the deathlog.Logger interface.

    ๐Ÿš€ Also included with this release is the ability to check for errors from the closers being closed. If death fails to close all the closers, or if several closers return an error, the errors will be concatenated and bubbled up to the caller of death.WaitForDeath(closers...). See the example below:

    func main() { death := DEATH.NewDeath(SYS.SIGINT, SYS.SIGTERM) //pass the signals you want to end your applicationobjects := make([]io.Closer, 0) objects = append(objects, &NewType{}) // this will work as long as the type implements a Close method//when you want to block for shutdown signalserr := death.WaitForDeath(objects...) // this will finish when a signal of your type is sent to your applicationif err != nil { log.Println(err) os.Exit(1) } }type NewType struct { }func (c \*NewType) Close() error { return fmt.Errorf("an error") }