diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-07-07 05:19:48 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-07-07 05:19:48 +0300 |
commit | 86afc1dfeeb07fbc140d08ef8cdcfd8cbd4d7bcb (patch) | |
tree | 41a2d15d113a8dba2513ca42d9c82722d1c5892b /internal/acme/acme.go | |
parent | e74c91bfe5c95d6da82691e0c753cc50b661613c (diff) |
Improve logging and correlation ID
Diffstat (limited to 'internal/acme/acme.go')
-rw-r--r-- | internal/acme/acme.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/acme/acme.go b/internal/acme/acme.go index 3bfa8f2e..039be32a 100644 --- a/internal/acme/acme.go +++ b/internal/acme/acme.go @@ -6,9 +6,8 @@ import ( "path/filepath" "strings" - log "github.com/sirupsen/logrus" - "gitlab.com/gitlab-org/gitlab-pages/internal/host" + "gitlab.com/gitlab-org/gitlab-pages/internal/logging" ) // Middleware handles acme challenges by redirecting them to GitLab instance @@ -45,7 +44,7 @@ func isAcmeChallenge(path string) bool { func (m *Middleware) redirectToGitlab(w http.ResponseWriter, r *http.Request) bool { redirectURL, err := url.Parse(m.GitlabURL) if err != nil { - log.WithError(err).Error("Can't parse GitLab URL for acme challenge redirect") + logging.LogRequest(r).WithError(err).Error("Can't parse GitLab URL for acme challenge redirect") return false } @@ -55,7 +54,7 @@ func (m *Middleware) redirectToGitlab(w http.ResponseWriter, r *http.Request) bo query.Set("token", filepath.Base(r.URL.Path)) redirectURL.RawQuery = query.Encode() - log.WithField("redirect_url", redirectURL).Debug("Redirecting to GitLab for processing acme challenge") + logging.LogRequest(r).WithField("redirect_url", redirectURL).Debug("Redirecting to GitLab for processing acme challenge") http.Redirect(w, r, redirectURL.String(), http.StatusTemporaryRedirect) return true |