dendrite/vendor/src/gopkg.in/airbrake/gobrake.v2
Kegan Dougal 63d1bcd66a Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
..
LICENSE Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
Makefile Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
README.md Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
bench_test.go Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
gobrake.go Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
notice.go Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
notifier.go Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
notifier_test.go Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00
util.go Add logrus, prometheus client and matrix-org/util 2017-02-03 15:41:25 +00:00

README.md

Airbrake Golang Notifier Build Status

Example

package main

import (
	"errors"

	"gopkg.in/airbrake/gobrake.v2"
)

var airbrake = gobrake.NewNotifier(1234567, "FIXME")

func init() {
	airbrake.AddFilter(func(notice *gobrake.Notice) *gobrake.Notice {
		notice.Context["environment"] = "production"
		return notice
	})
}

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

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

Ignoring notices

airbrake.AddFilter(func(notice *gobrake.Notice) *gobrake.Notice {
	if notice.Context["environment"] == "development" {
		// Ignore notices in development environment.
		return nil
	}
	return notice
})

Logging

You can use glog fork to send your logs to Airbrake.