diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-10-02 16:00:22 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-10-02 16:00:22 +0300 |
commit | 9ecd5703d7c0325c01c65c51a9ec625b1436a1ad (patch) | |
tree | 6c91b45200631720338466a49a05f849feddfc3a /internal/logging | |
parent | 78c7e7be19993403054f8584fbc5b6c17885b20f (diff) | |
parent | 9943255d61c5646f6cf9e1a8a03e4a2dc19831f5 (diff) |
Merge branch 'master' into backstage/gb/domain-serving-refactoring
Diffstat (limited to 'internal/logging')
-rw-r--r-- | internal/logging/logging.go | 8 |
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, + }) +} |