improve loggin
This commit is contained in:
parent
4da9b60aa1
commit
a07d4f4d69
|
@ -35,8 +35,12 @@ func NewModulLog(modul string) *ModulLog {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModulLog) GetLog(r *http.Request, request string) *log.Entry {
|
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{
|
return m.log.WithFields(log.Fields{
|
||||||
"remote": r.RemoteAddr,
|
"remote": ip,
|
||||||
"request": request,
|
"request": request,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue