airbrake

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package airbrake provides Airbrake integration.

Create a new handler as you would create a gobrake.Notifier:

projectID  := int64(1)
projectKey := "key"

handler := airbrake.NewHandler(projectID, projectKey)

If you need access to the underlying Notifier instance (or need more advanced construction), you can create the handler from a notifier directly:

projectID  := int64(1)
projectKey := "key"

notifier := gobrake.NewNotifier(projectID, projectKey)
handler := airbrake.NewHandlerFromNotifier(notifier)

By default Gobrake sends errors asynchronously and expects to be closed before the program finishes:

func main() {
	defer handler.Close()
}

If you want to Flush notices you can do it as you would with Gobrake's notifier or you can configure the handler to send notices synchronously:

handler := airbrake.NewHandlerFromNotifier(notifier, airbrake.SendSynchronously(true))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is responsible for sending errors to Airbrake/Errbit.

func NewHandler

func NewHandler(projectID int64, projectKey string, opts ...Option) *Handler

NewHandler creates a new Airbrake handler.

func NewHandlerFromNotifier added in v0.10.0

func NewHandlerFromNotifier(notifier *gobrake.Notifier, opts ...Option) *Handler

NewHandlerFromNotifier creates a new Airbrake handler from a notifier instance.

func (*Handler) Close

func (h *Handler) Close() error

Close closes the underlying Airbrake instance.

func (*Handler) Handle

func (h *Handler) Handle(err error)

Handle calls the underlying Airbrake notifier.

type Option added in v0.10.0

type Option interface {
	// contains filtered or unexported methods
}

Option configures a logger instance.

type SendSynchronously added in v0.10.0

type SendSynchronously bool

SendSynchronously configures the handler to send notices synchronously.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL