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

27 lines
420 B
Go

package bugsnag
import (
"net/http"
"github.com/bugsnag/bugsnag-go/v2"
"github.com/imgproxy/imgproxy/v2/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)
}
}