access log新增系统变量

This commit is contained in:
Liujian
2023-11-04 10:25:03 +08:00
parent 62aaeda4ed
commit 58055be81c
9 changed files with 115 additions and 14 deletions

View File

@@ -20,6 +20,8 @@ type requestAgent struct {
beginTime time.Time
endTime time.Time
hostAgent *UrlAgent
remoteIP string
remotePort int
}
func (a *requestAgent) ResponseBody() string {
@@ -53,6 +55,14 @@ func (a *requestAgent) setResponseLength(length int) {
}
}
func (a *requestAgent) setRemoteIP(ip string) {
a.remoteIP = ip
}
func (a *requestAgent) setRemotePort(port int) {
a.remotePort = port
}
func newRequestAgent(IRequest http_service.IRequest, host string, scheme string, beginTime, endTime time.Time) *requestAgent {
return &requestAgent{IRequest: IRequest, host: host, scheme: scheme, beginTime: beginTime, endTime: endTime}
}
@@ -61,6 +71,14 @@ func (a *requestAgent) ResponseTime() int64 {
return a.endTime.Sub(a.beginTime).Milliseconds()
}
func (a *requestAgent) RemoteIP() string {
return a.remoteIP
}
func (a *requestAgent) RemotePort() int {
return a.remotePort
}
func (a *requestAgent) URI() http_service.IURIWriter {
if a.hostAgent == nil {
a.hostAgent = NewUrlAgent(a.IRequest.URI(), a.host, a.scheme)