Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 870 Bytes

README.md

File metadata and controls

32 lines (21 loc) · 870 Bytes

scout

scout is a middleware for the chi-router to report events to sentry.io using the sentry-go client.

The sentry-go client must be initialized with sentry.Init.

This middleware also replaces middleware.Recoverer which should not be used alongside with this middleware.

Here is an example on how to use the middleware:

import (
	"net/http"

	"github.com/go-chi/chi"
	"github.com/zy4/scout"
)

r := chi.NewRouter()

// Use the middleware in the router
r.Use(scout.SentryRecovery)

r.Get("/", func(w http.ResponseWriter, r *http.Request) {
    panic("caught")
})

Attribution

scout was created to emulate the raven-go middleware raven-chi for the official sentry-go SDK since raven-go is deprecated.