修复glog.SetDebug失效问题,关闭ghttp.Server的日志信息终端显示

This commit is contained in:
John
2018-09-18 21:29:31 +08:00
parent 176ff2dd58
commit d1b0a5702a
3 changed files with 7 additions and 5 deletions

View File

@ -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{}{}
}

View File

@ -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

View File

@ -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) {