blob: 2ecddf6c5f11fccc76d0e4337b27602215dff49f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package domain
import (
"net/http"
"gitlab.com/gitlab-org/labkit/log"
)
func LogFields(r *http.Request) log.Fields {
logFields := log.Fields{
"pages_https": r.URL.Scheme == "https",
"pages_host": GetHost(r),
}
d := FromRequest(r)
if d == nil {
return logFields
}
lp, err := d.GetLookupPath(r)
if err != nil {
logFields["error"] = err.Error()
return logFields
}
logFields["pages_project_serving_type"] = lp.ServingType
logFields["pages_project_prefix"] = lp.Prefix
logFields["pages_project_id"] = lp.ProjectID
return logFields
}
|