If you’re working with the net/http package, you can easily create a to pass different http calls to different functions. A allows you to keep track of these calls. In this example, we just log the call to the terminal (or stdout). To use this wrap any handlers you have with .
package main import ( "log" "net/http" "time" ) func Logger(inner http.Handler, name string) http.Handler { return http.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here