integration

package
v0.0.0-...-c5c64c4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

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

Email implements the Integration interface and uses SMTP to deliver the notifications

func NewDefaultEmail

func NewDefaultEmail(email, password string) *Email

NewDefaultEmail returns an email integration with the default settings. The default settings use gmail's smtp and ssl

func NewEmail

func NewEmail(cfg *SMTPConfig) *Email

NewEmail returns an email integration

func (Email) Deliver

func (e Email) Deliver(n *Notification) error

func (Email) StackTraceLines

func (Email) StackTraceLines() int

type Integration

type Integration interface {
	// StackTraceLines return the number of stack trace lines
	// to be sent in each notification
	StackTraceLines() int

	// Deliver delivers the given notification and returns an error if any.
	Deliver(*Notification) error
}

Integration is the interface used to deliver a notification of a panic

type Notification

type Notification struct {
	Err     error
	Host    string // the machine's hostname
	Stack   []string
	Request *Request
}

Notification contains information about what caused the panic

type Request

type Request struct {
	Method string
	URI    string // the relative url
}

Request holds information about the request that caused the panic

type SMTPConfig

type SMTPConfig struct {
	Addr     string
	Port     int
	User     string
	Password string
}

SMTPConfig contains the SMTP configuration

type Slack

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

Slack implements the Integration interface and uses Slack's Incoming Webhooks API to deliver the notifications

func NewSlack

func NewSlack(url string) *Slack

NewSlack returns a slack itegration

func (Slack) Deliver

func (s Slack) Deliver(n *Notification) error

func (*Slack) SetHTTPClient

func (s *Slack) SetHTTPClient(c *http.Client)

SetHTTPClient sets the http.Client used to deliver the notification

func (Slack) StackTraceLines

func (Slack) StackTraceLines() int

type WebHook

type WebHook struct {
	URL    string
	Client *http.Client
}

WebHook implements the Integration interface and delivers the notifications over the HTTP protocol

func NewWebHook

func NewWebHook(url string) *WebHook

NewWebHook returns a webhook integration

func (WebHook) Deliver

func (w WebHook) Deliver(n *Notification) error

func (WebHook) StackTraceLines

func (WebHook) StackTraceLines() int

Jump to

Keyboard shortcuts

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