sum7/warehost
sum7
/
warehost
Archived
1
0
Fork 0

improve loggin

This commit is contained in:
Martin Geno 2016-08-14 18:41:56 +02:00
parent 4da9b60aa1
commit a07d4f4d69
1 changed files with 5 additions and 1 deletions

View File

@ -35,8 +35,12 @@ func NewModulLog(modul string) *ModulLog {
}
func (m *ModulLog) GetLog(r *http.Request, request string) *log.Entry {
ip := r.Header.Get("X-Real-IP")
if len(ip) <= 1 {
ip = r.RemoteAddr
}
return m.log.WithFields(log.Fields{
"remote": r.RemoteAddr,
"remote": ip,
"request": request,
})
}