mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-08 10:45:04 +02:00
27 lines
420 B
Go
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)
|
|
}
|
|
}
|