simplify logger time and avoid possible crashes (#13986)

time.Format() is not necessary prematurely for JSON
marshalling, since JSON marshalling indeed defaults
to RFC3339Nano.

This also ensures the 'time' is remembered until its
logged and it is the same time when the 'caller'
invoked 'log' functions.
This commit is contained in:
Harshavardhana
2021-12-23 15:33:54 -08:00
committed by GitHub
parent 5a96cbbeaa
commit 9ad6012782
6 changed files with 38 additions and 31 deletions

View File

@@ -349,7 +349,7 @@ func logIf(ctx context.Context, err error, errKind ...interface{}) {
Host: req.Host,
RequestID: req.RequestID,
UserAgent: req.UserAgent,
Time: time.Now().UTC().Format(time.RFC3339Nano),
Time: time.Now().UTC(),
API: &log.API{
Name: API,
Args: &log.Args{