mirror of https://github.com/matrix-org/go-neb.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Richard Lewis
34c4874acd
|
8 years ago | |
---|---|---|
.. | ||
LICENSE | 9 years ago | |
README.md | 9 years ago | |
bench_test.go | 9 years ago | |
circle.yml | 9 years ago | |
gobrake.go | 9 years ago | |
notice.go | 9 years ago | |
notifier.go | 9 years ago | |
notifier_test.go | 9 years ago | |
util.go | 9 years ago |
README.md
Airbrake Golang Notifier
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.WaitAndClose(5*time.Second)
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.