package ksrv import ( "net/http" "kumoly.io/lib/klog" ) type kserver struct { http.Server l *klog.Logger nolog func(r *http.Request) bool } // Listen to addr func (s *kserver) Handle(h http.Handler) *kserver { s.Handler = h return s } // Listen to addr func (s *kserver) Listen(addr string) *kserver { s.Addr = addr return s } // Serve alias to ListenAndServe func (s *kserver) Serve() error { return s.ListenAndServe() } func (s *kserver) ListenAndServe() error { s.Handler = s.Middleware(s.Handler) return s.Server.ListenAndServe() } func (s *kserver) ListenAndServeTLS(certFile string, keyFile string) error { s.Handler = s.Middleware(s.Handler) return s.Server.ListenAndServeTLS(certFile, keyFile) }