tsweb: rename AccessLogRecord's When to Time

This change makes our access log record more consistent with the
new log/tslog package formatting of "time". Note that we can
change slog itself to call "time" "when" but we're chosing
to make this breaking change to be consistent with the std lib's
defaults.

Updates tailscale/corp#17071

Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
This commit is contained in:
Marwan Sulaiman
2024-05-21 13:34:27 -04:00
committed by Marwan Sulaiman
parent 0380cbc90d
commit 7e357e1636
3 changed files with 26 additions and 26 deletions

View File

@ -299,7 +299,7 @@ type retHandler struct {
// ServeHTTP implements the http.Handler interface.
func (h retHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
msg := AccessLogRecord{
When: h.opts.Now(),
Time: h.opts.Now(),
RemoteAddr: r.RemoteAddr,
Proto: r.Proto,
TLS: r.TLS != nil,
@ -371,7 +371,7 @@ func (h retHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
lw.code = 200
}
msg.Seconds = h.opts.Now().Sub(msg.When).Seconds()
msg.Seconds = h.opts.Now().Sub(msg.Time).Seconds()
msg.Code = lw.code
msg.Bytes = lw.bytes