fixed some bugs related to middleware

This commit is contained in:
luke.rodham
2018-03-12 11:29:18 +00:00
parent 1e787689aa
commit 971f157307
5 changed files with 23 additions and 6 deletions

View File

@@ -1,11 +1,13 @@
package middleware
import "github.com/lukerodham/tuu"
import (
"github.com/lukerodham/tuu"
)
// RequestLogger is a default/example implementation of how a logging middleware would be implemented.
func RequestLogger(next tuu.Handler) tuu.Handler {
return func(c tuu.Context) error {
c.Logger().WithField("url", c.Value("path")).Debug("New request")
c.Logger().WithField("url", c.Value("path")).Info("New request")
return next(c)
}