From e4db6e1b99018bbcf70051adc15963751cb94215 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 1 May 2023 21:43:21 -0600 Subject: still log requests for which we failed to find a handler --- logging/middleware.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'logging/middleware.go') diff --git a/logging/middleware.go b/logging/middleware.go index ffce1b7..b19c273 100644 --- a/logging/middleware.go +++ b/logging/middleware.go @@ -16,6 +16,15 @@ func LogRequests(logger Logger) sr.Middleware { response := inner.Handle(ctx, request) if response != nil { response.Body = loggingBody(logger, request, response, start) + } else { + end := time.Now() + logger.Log( + "msg", "request", + "ts", end.UTC(), + "dur", end.Sub(start), + "url", request.URL, + "status", "(not found)", + ) } return response -- cgit v1.2.3