From c781a7ccd3147f750faeda631db15d06de455949 Mon Sep 17 00:00:00 2001 From: Tuomo Ala-Vannesluoma Date: Thu, 26 Sep 2019 13:35:28 +0000 Subject: Add support for previewing artifacts that are not public Remove some duplicate logic on Auth module Separate handling artifact to own handlers package Unit test handlers by mocking auth and artifact modules Add generate-mock step to Makefile Use additional handler func to simplify TryMakeRequest return type Always try with token if exists Do not log RequestURI, log path only Remove not used logRequest func --- internal/logging/logging.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/logging') diff --git a/internal/logging/logging.go b/internal/logging/logging.go index f0682573..9269261d 100644 --- a/internal/logging/logging.go +++ b/internal/logging/logging.go @@ -78,3 +78,11 @@ func AccessLogger(handler http.Handler, format string) (http.Handler, error) { log.WithAccessLogger(accessLogger), ), nil } + +// LogRequest will inject request host and path to the logged messages +func LogRequest(r *http.Request) *logrus.Entry { + return log.WithFields(log.Fields{ + "host": r.Host, + "path": r.URL.Path, + }) +} -- cgit v1.2.3