Skip to content

Commit 65b3a2e

Browse files
committed
Merge branch 'release/0.2.8'
2 parents 4fa2bec + bbe4397 commit 65b3a2e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

router.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// license that can be found in the LICENSE file.
44

55
/*
6-
Package router 0.2.7 provides fast HTTP request router.
6+
Package router 0.2.8 provides fast HTTP request router.
77
88
The router matches incoming requests by the request method and the path.
99
If a handle is registered for this path and method, the router delegates the
@@ -92,8 +92,8 @@ type Router struct {
9292
// http status code http.StatusInternalServerError (500)
9393
PanicHandler Handle
9494

95-
// Logger activates logging for each requests
96-
Logger bool
95+
// Logger activates logging user function for each requests
96+
Logger Handle
9797
}
9898

9999
// Handle type is aliased to type of handler function.
@@ -182,8 +182,9 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
182182
}
183183
}
184184
}()
185-
if r.Logger {
186-
log.Println(req.RemoteAddr, req.Method, req.URL.Path)
185+
if r.Logger != nil {
186+
c := &Control{Request: req, Writer: w}
187+
r.Logger(c)
187188
}
188189
if _, ok := r.handlers[req.Method]; ok {
189190
if handle, params, ok := r.handlers[req.Method].get(req.URL.Path); ok {

0 commit comments

Comments
 (0)