recovery: resenje.org/recovery Index | Files

package recovery

import "resenje.org/recovery"

Index

Package Files

recovery.go

type Notifier Uses

type Notifier interface {
    Notify(title, body string) error
}

Notifier defines interface to inject into Service for panic notifications.

type Service Uses

type Service struct {
    Version   string
    BuildInfo string
    LogFunc   func(...interface{})

    Notifier Notifier
}

Service provides unified way of logging and notifying panic events.

func (Service) Recover Uses

func (s Service) Recover()

Recover is a function that recovers from panic, logs and notifies event. It should be used as an argument to defer statement:

   recoveryService := &recovery.Service{...}
   go func() {
       defer recoveryService.Recover()
	   ...
   }

Package recovery imports 3 packages (graph) and is imported by 4 packages. Updated 2020-02-14. Refresh now. Tools for package owners.