1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-23 11:14:48 +02:00
2021-09-30 20:23:30 +06:00

33 lines
573 B
Go

package airbrake
import (
"net/http"
"github.com/airbrake/gobrake/v5"
"github.com/imgproxy/imgproxy/v3/config"
)
var notifier *gobrake.Notifier
func Init() {
if len(config.AirbrakeProjecKey) > 0 {
notifier = gobrake.NewNotifierWithOptions(&gobrake.NotifierOptions{
ProjectId: int64(config.AirbrakeProjecID),
ProjectKey: config.AirbrakeProjecKey,
Environment: config.AirbrakeEnv,
})
}
}
func Report(err error, req *http.Request) {
if notifier != nil {
notifier.Notify(err, req)
}
}
func Close() {
if notifier != nil {
notifier.Close()
}
}