mirror of https://github.com/toorop/gin-logrus.git
fix #3
This commit is contained in:
parent
fd3afab50f
commit
5d05462a6e
|
@ -6,8 +6,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 2016-09-27 09:38:21.541541811 +0200 CEST
|
// 2016-09-27 09:38:21.541541811 +0200 CEST
|
||||||
|
@ -26,7 +26,7 @@ func Logger(log *logrus.Logger) gin.HandlerFunc {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
c.Next()
|
c.Next()
|
||||||
stop := time.Since(start)
|
stop := time.Since(start)
|
||||||
latency := int(math.Ceil(float64(stop.Nanoseconds()) / 1000.0))
|
latency := int(math.Ceil(float64(stop.Nanoseconds()) / 1000000.0))
|
||||||
statusCode := c.Writer.Status()
|
statusCode := c.Writer.Status()
|
||||||
clientIP := c.ClientIP()
|
clientIP := c.ClientIP()
|
||||||
clientUserAgent := c.Request.UserAgent()
|
clientUserAgent := c.Request.UserAgent()
|
||||||
|
|
Loading…
Reference in New Issue