recovery

package module
Version: v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2018 License: BSD-3-Clause Imports: 3 Imported by: 9

README

Service to handle recovery from panic events in Go

GoDoc Build Status

Installation

Run go get resenje.org/recovery from command line.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

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

Notifier defines interface to inject into Service for panic notifications.

type Service

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

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()
	   ...
   }

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL