|
@@ -4,18 +4,26 @@ import (
|
|
|
"net/http"
|
|
|
|
|
|
"github.com/bugsnag/bugsnag-go/v2"
|
|
|
+ "github.com/sirupsen/logrus"
|
|
|
|
|
|
"github.com/imgproxy/imgproxy/v3/config"
|
|
|
)
|
|
|
|
|
|
var enabled bool
|
|
|
|
|
|
+type logger struct{}
|
|
|
+
|
|
|
+func (l logger) Printf(format string, v ...interface{}) {
|
|
|
+ logrus.WithField("source", "bugsnag").Debugf(format, v...)
|
|
|
+}
|
|
|
+
|
|
|
func Init() {
|
|
|
if len(config.BugsnagKey) > 0 {
|
|
|
bugsnag.Configure(bugsnag.Configuration{
|
|
|
APIKey: config.BugsnagKey,
|
|
|
ReleaseStage: config.BugsnagStage,
|
|
|
PanicHandler: func() {}, // Disable forking the process
|
|
|
+ Logger: logger{},
|
|
|
})
|
|
|
enabled = true
|
|
|
}
|