Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-10-02 16:00:22 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-10-02 16:00:22 +0300
commit9ecd5703d7c0325c01c65c51a9ec625b1436a1ad (patch)
tree6c91b45200631720338466a49a05f849feddfc3a /internal/logging
parent78c7e7be19993403054f8584fbc5b6c17885b20f (diff)
parent9943255d61c5646f6cf9e1a8a03e4a2dc19831f5 (diff)
Merge branch 'master' into backstage/gb/domain-serving-refactoring
Diffstat (limited to 'internal/logging')
-rw-r--r--internal/logging/logging.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/logging/logging.go b/internal/logging/logging.go
index 7c2f013e..28c43c2e 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,
+ })
+}