From b5ddd484de8ff3a6ebf4ef2295a1013db1ad3156 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Mon, 7 Jul 2014 03:04:06 +0200 Subject: [PATCH] Timestamp is calculated once --- logger.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/logger.go b/logger.go index 7bd87b70..ff843a1c 100644 --- a/logger.go +++ b/logger.go @@ -60,9 +60,10 @@ func Logger() HandlerFunc { default: 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", - time.Now().Format("2006/01/02 - 15:04:05"), + end.Format("2006/01/02 - 15:04:05"), color, c.Writer.Status(), reset, latency, c.Engine.CacheStress()*100,