1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-08 10:45:04 +02:00
imgproxy/errorreport/bugsnag/bugsnag.go
2021-09-30 20:23:30 +06:00

27 lines
420 B
Go

package bugsnag
import (
"net/http"
"github.com/bugsnag/bugsnag-go/v2"
"github.com/imgproxy/imgproxy/v3/config"
)
var enabled bool
func Init() {
if len(config.BugsnagKey) > 0 {
bugsnag.Configure(bugsnag.Configuration{
APIKey: config.BugsnagKey,
ReleaseStage: config.BugsnagStage,
})
enabled = true
}
}
func Report(err error, req *http.Request) {
if enabled {
bugsnag.Notify(err, req)
}
}