This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-09-09 08:39:23 +03:00
parent d17a888dc1
commit fb7627256a
No known key found for this signature in database
GPG Key ID: 5DBE766BD26A54E7

View File

@ -156,12 +156,12 @@ func sessionHandler(ctx iris.Context) {
} }
func fieldsHandler(ctx iris.Context) { func fieldsHandler(ctx iris.Context) {
// simulate a heavy job...
start := time.Now() start := time.Now()
// simulate a heavy job...
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
end := time.Since(start) end := time.Since(start)
// Get the current fields instance and use // Get the current fields instance
// them to it custom log values. // and use it to set custom log values.
logFields := accesslog.GetFields(ctx) logFields := accesslog.GetFields(ctx)
logFields.Set("job_latency", end.Round(time.Second)) logFields.Set("job_latency", end.Round(time.Second))