mirror of
https://github.com/labstack/echo.git
synced 2025-12-01 22:51:17 +02:00
Flexible handler and middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@@ -8,10 +8,10 @@ import (
|
||||
"github.com/labstack/gommon/color"
|
||||
)
|
||||
|
||||
func Logger() bolt.HandlerFunc {
|
||||
return func(c *bolt.Context) {
|
||||
func Logger(h bolt.HandlerFunc) bolt.HandlerFunc {
|
||||
return bolt.HandlerFunc(func(c *bolt.Context) {
|
||||
start := time.Now()
|
||||
c.Next()
|
||||
h(c)
|
||||
end := time.Now()
|
||||
col := color.Green
|
||||
m := c.Request.Method
|
||||
@@ -28,5 +28,5 @@ func Logger() bolt.HandlerFunc {
|
||||
}
|
||||
|
||||
log.Printf("%s %s %s %s", m, p, col(s), end.Sub(start))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user