Timestamp is calculated once

This commit is contained in:
Manu Mtz-Almeida 2014-07-07 03:04:06 +02:00
parent 31417dbc63
commit b5ddd484de
1 changed files with 3 additions and 2 deletions

View File

@ -60,9 +60,10 @@ func Logger() HandlerFunc {
default: default:
color = red color = red
} }
latency := time.Since(start) end := time.Now()
latency := end.Sub(start)
stdlogger.Printf("[GIN] %v |%s %3d %s| %12v | %3.1f%% | %s %4s %s\n", stdlogger.Printf("[GIN] %v |%s %3d %s| %12v | %3.1f%% | %s %4s %s\n",
time.Now().Format("2006/01/02 - 15:04:05"), end.Format("2006/01/02 - 15:04:05"),
color, c.Writer.Status(), reset, color, c.Writer.Status(), reset,
latency, latency,
c.Engine.CacheStress()*100, c.Engine.CacheStress()*100,