mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
add time field to json access log
This commit is contained in:
parent
2e86f8e6d8
commit
942651dc16
1 changed files with 2 additions and 0 deletions
|
@ -20,6 +20,7 @@ type (
|
||||||
CommonFormatter
|
CommonFormatter
|
||||||
}
|
}
|
||||||
JSONLogEntry struct {
|
JSONLogEntry struct {
|
||||||
|
Time string `json:"time"`
|
||||||
IP string `json:"ip"`
|
IP string `json:"ip"`
|
||||||
Method string `json:"method"`
|
Method string `json:"method"`
|
||||||
Scheme string `json:"scheme"`
|
Scheme string `json:"scheme"`
|
||||||
|
@ -101,6 +102,7 @@ func (f JSONFormatter) Format(line *bytes.Buffer, req *http.Request, res *http.R
|
||||||
cookies := f.cfg.Cookies.ProcessCookies(req.Cookies())
|
cookies := f.cfg.Cookies.ProcessCookies(req.Cookies())
|
||||||
|
|
||||||
entry := JSONLogEntry{
|
entry := JSONLogEntry{
|
||||||
|
Time: timeNow(),
|
||||||
IP: clientIP(req),
|
IP: clientIP(req),
|
||||||
Method: req.Method,
|
Method: req.Method,
|
||||||
Scheme: scheme(req),
|
Scheme: scheme(req),
|
||||||
|
|
Loading…
Add table
Reference in a new issue