File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 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
88The router matches incoming requests by the request method and the path.
99If 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 {
You can’t perform that action at this time.
0 commit comments