Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.3 KB

README.md

File metadata and controls

44 lines (32 loc) · 1.3 KB

faultline-go Build Status GitHub release

faultline exception and error notifier for Go.

Requirement

Usage

package main

import (
	"errors"
	"github.com/faultline/faultline-go/faultline"
)

var notifications = []interface{}{
	faultline.Slack{
		Type:           "slack",
		Endpoint:       "https://hooks.slack.com/services/XXXXXXXXXX/BAC0D0N69/NacHbWgIfklAHH7XBEItGNcs",
		Channel:        "#random",
		Username:       "faultline-notify",
		NotifyInterval: 5,
		Threshold:      10,
		Timezone:       "Asia/Tokyo",
	},
}

var notifier = faultline.NewNotifier("faultline-go-project", "xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX", "https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/v0", notifications)

func main() {
	defer notifier.Close()
	defer notifier.NotifyOnPanic()

	notifier.Notify(errors.New("operation failed"), nil)
}

References