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:
Diffstat (limited to 'internal/logging/logging.go')
-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 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,
+ })
+}