mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-10 16:33:11 -06:00
| .. | ||
| bench_test.go | ||
| gobrake.go | ||
| LICENSE | ||
| Makefile | ||
| notice.go | ||
| notifier.go | ||
| notifier_test.go | ||
| README.md | ||
| util.go | ||
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.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.