Initial commit

This commit is contained in:
Manu Mtz-Almeida
2014-06-18 01:42:34 +02:00
commit 15216a0883
7 changed files with 965 additions and 0 deletions

20
logger.go Normal file
View File

@ -0,0 +1,20 @@
package gin
import (
"log"
"time"
)
func Logger() HandlerFunc {
return func(c *Context) {
// Start timer
t := time.Now()
// Process request
c.Next()
// Calculate resolution time
log.Printf("[%d] %s in %v", c.Writer.Status(), c.Req.RequestURI, time.Since(t))
}
}