mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 11:47:42 +00:00
skip logging for health check
This commit is contained in:
parent
bcb53235f8
commit
50cdc3aafa
1 changed files with 6 additions and 0 deletions
|
@ -114,6 +114,12 @@ func (lrw *LoggingResponseWriter) WriteHeader(statusCode int) {
|
||||||
|
|
||||||
func (a *api) loggingMiddleware(next http.Handler) http.Handler {
|
func (a *api) loggingMiddleware(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Skip logging health checks
|
||||||
|
if r.RequestURI == "/v1/health" {
|
||||||
|
next.ServeHTTP(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
lrw := &LoggingResponseWriter{w: w}
|
lrw := &LoggingResponseWriter{w: w}
|
||||||
// Do stuff here
|
// Do stuff here
|
||||||
|
|
Loading…
Reference in a new issue