log whats happening in http handler

This commit is contained in:
Asim Aslam 2020-04-19 00:41:03 +01:00
parent a08ff90976
commit 226d6ad22b

View File

@ -51,18 +51,22 @@ func (s *httpServer) Init(opts ...server.Option) error {
}
func (s *httpServer) Handle(path string, handler http.Handler) {
h := handlers.CombinedLoggingHandler(os.Stdout, handler)
// TODO: move this stuff out to one place with ServeHTTP
// apply the wrappers, e.g. auth
for _, wrapper := range s.opts.Wrappers {
h = wrapper(h)
handler = wrapper(handler)
}
// wrap with cors
if s.opts.EnableCORS {
h = cors.CombinedCORSHandler(h)
handler = cors.CombinedCORSHandler(handler)
}
s.mux.Handle(path, h)
// wrap with logger
handler = handlers.CombinedLoggingHandler(os.Stdout, handler)
s.mux.Handle(path, handler)
}
func (s *httpServer) Start() error {