middleware/log: make {size} the length of the request (#449)
* middleware/log: make {size} the length of the request {size} is the lenght of the request, {rsize} is the length of the reply. * Fix test
This commit is contained in:
parent
b85c6788dd
commit
b086e5f64d
4 changed files with 10 additions and 8 deletions
|
@ -42,6 +42,7 @@ func New(r *dns.Msg, rr *dnsrecorder.Recorder, emptyValue string) Replacer {
|
|||
"{when}": func() string {
|
||||
return time.Now().Format(timeFormat)
|
||||
}(),
|
||||
"{size}": strconv.Itoa(req.Len()),
|
||||
"{remote}": req.IP(),
|
||||
"{port}": req.Port(),
|
||||
},
|
||||
|
@ -53,7 +54,7 @@ func New(r *dns.Msg, rr *dnsrecorder.Recorder, emptyValue string) Replacer {
|
|||
rcode = strconv.Itoa(rr.Rcode)
|
||||
}
|
||||
rep.replacements["{rcode}"] = rcode
|
||||
rep.replacements["{size}"] = strconv.Itoa(rr.Len)
|
||||
rep.replacements["{rsize}"] = strconv.Itoa(rr.Len)
|
||||
rep.replacements["{duration}"] = time.Since(rr.Start).String()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue