go-problem-reporter captures HTTP responses that conform to RFC7807 Problem Details from your web application and sends to error reporting services.
Currently supported services:
package main
import (
"github.com/getsentry/sentry-go"
"github.com/moogar0880/problems"
sentryhttp "github.com/getsentry/sentry-go/http"
sentryreporter "github.com/aereal/go-problem-reporter/sentry"
)
func main() {
h := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
p := problems.NewDetailedProblem(http.StatusInternalServerError, "some details"),
problems.StatusProblemHandler(p).ServeHTTP(rw, r)
})
mw := sentryreporter.New(sentryreporter.Options{WaitForDelivery: true})
withSentryHub := sentryhttp.New(sentryhttp.Options{}).Handle
&http.Server{
Handler: withSentryHub(mw(h)),
}
}
go get github.com/aereal/go-problem-reporter
See LICENSE file.