From 0c2679ae1f37598e4d31e06f1e3c2958ce891dc4 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 18 Sep 2018 21:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dglog.SetDebug=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98=EF=BC=8C=E5=85=B3=E9=97=ADghttp.Ser?= =?UTF-8?q?ver=E7=9A=84=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g/net/ghttp/ghttp_server.go | 4 +--- g/net/ghttp/ghttp_server_handler.go | 2 +- g/os/glog/glog_logger.go | 6 +++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/g/net/ghttp/ghttp_server.go b/g/net/ghttp/ghttp_server.go index 3797e89f5..3ff06baa4 100644 --- a/g/net/ghttp/ghttp_server.go +++ b/g/net/ghttp/ghttp_server.go @@ -177,9 +177,7 @@ func GetServer(name...interface{}) (*Server) { closeQueue : gqueue.New(), logger : glog.New(), } - // 设置路由解析缓存上限,使用LRU进行缓存淘汰 - s.serveCache.SetCap(gSERVE_CACHE_LRU_SIZE) - s.hooksCache.SetCap(gHOOKS_CACHE_LRU_SIZE) + s.logger.SetStdPrint(false) for _, v := range strings.Split(gHTTP_METHODS, ",") { s.methodsMap[v] = struct{}{} } diff --git a/g/net/ghttp/ghttp_server_handler.go b/g/net/ghttp/ghttp_server_handler.go index 3a312d685..c5a1b8b92 100644 --- a/g/net/ghttp/ghttp_server_handler.go +++ b/g/net/ghttp/ghttp_server_handler.go @@ -59,7 +59,7 @@ func (s *Server)handleRequest(w http.ResponseWriter, r *http.Request) { // 如果是目录需要处理index files if len(s.config.IndexFiles) > 0 { for _, file := range s.config.IndexFiles { - fpath := s.paths.Search(filePath + gfile.Separator + file) + fpath := s.paths.Search(file) if fpath != "" { filePath = fpath request.isFileRequest = true diff --git a/g/os/glog/glog_logger.go b/g/os/glog/glog_logger.go index 2d764f8eb..3ee8d8943 100644 --- a/g/os/glog/glog_logger.go +++ b/g/os/glog/glog_logger.go @@ -72,7 +72,11 @@ func (l *Logger) GetLevel() int { // 快捷方法,打开或关闭DEBU日志信息 func (l *Logger) SetDebug(debug bool) { - l.level.Set(l.level.Val()|LEVEL_DEBU) + if debug { + l.level.Set(l.level.Val()|LEVEL_DEBU) + } else { + l.level.Set(l.level.Val()&^LEVEL_DEBU) + } } func (l *Logger) SetBacktrace(enabled bool) {