Skip to content

faultline/faultline-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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