From 765b3fe171b72111d9f89bbb7b211ee88679e3da Mon Sep 17 00:00:00 2001 From: sunshineplan Date: Mon, 18 Dec 2023 09:38:19 +0800 Subject: [PATCH] httpsvr: SetLogger also set http.Server.ErrorLog --- httpsvr/httpsvr.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/httpsvr/httpsvr.go b/httpsvr/httpsvr.go index 4703877..d6713e7 100644 --- a/httpsvr/httpsvr.go +++ b/httpsvr/httpsvr.go @@ -41,6 +41,11 @@ func New() *Server { return &Server{Server: &http.Server{}, Logger: log.Default()} } +func (s *Server) SetLogger(logger *log.Logger) { + s.Logger = logger + s.Server.ErrorLog = logger.Logger +} + func (s *Server) SetReload(d time.Duration) { s.reload = d }