File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
internals/proxy/middlewares Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ package middlewares
2+
3+ import (
4+ "net/http"
5+
6+ log "github.com/codeshelldev/secured-signal-api/utils/logger"
7+ )
8+
9+ type LogMiddleware struct {
10+ Next http.Handler
11+ }
12+
13+ func (data LogMiddleware ) Use () http.Handler {
14+ next := data .Next
15+
16+ return http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
17+ log .Info ("Request:" , req .Method , req .URL .Path )
18+
19+ next .ServeHTTP (w , req )
20+ })
21+ }
Original file line number Diff line number Diff line change @@ -83,11 +83,15 @@ func main() {
8383 Token : ENV .API_TOKEN ,
8484 }
8585
86+ log_m0 := LogMiddleware {
87+ Next : auth_m1 .Use (),
88+ }
89+
8690 log .Info ("Initialized Proxy Handler" )
8791
8892 addr := "0.0.0.0:" + ENV .PORT
8993
9094 log .Info ("Server Listening on " , addr )
9195
92- http .ListenAndServe (addr , auth_m1 .Use ())
96+ http .ListenAndServe (addr , log_m0 .Use ())
9397}
You can’t perform that action at this time.
0 commit comments