From e3a491a16bdf5c22e95c359265f6cc15b3ed7770 Mon Sep 17 00:00:00 2001 From: john Date: Thu, 11 Oct 2018 09:56:01 +0800 Subject: [PATCH] =?UTF-8?q?gspath=E6=B7=BB=E5=8A=A0debug=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E6=94=B9=E8=BF=9Bglog=E9=93=BE=E5=BC=8F=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g/os/glog/glog_logger_linkop.go | 9 ++------- g/os/gspath/gspath.go | 1 + geg/other/test.go | 6 ++++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/g/os/glog/glog_logger_linkop.go b/g/os/glog/glog_logger_linkop.go index 837d1f1ba..cd0968a86 100644 --- a/g/os/glog/glog_logger_linkop.go +++ b/g/os/glog/glog_logger_linkop.go @@ -18,10 +18,9 @@ func (l *Logger) Cat(category string) *Logger { logger = l } path := l.path.Val() - if path == "" { - path = gfile.Pwd() + if path != "" { + logger.SetPath(path + gfile.Separator + category) } - logger.SetPath(path + gfile.Separator + category) return logger } @@ -33,10 +32,6 @@ func (l *Logger) File(file string) *Logger { } else { logger = l } - path := l.path.Val() - if path == "" { - path = gfile.Pwd() - } logger.SetFile(file) return logger } diff --git a/g/os/gspath/gspath.go b/g/os/gspath/gspath.go index d3317fa3b..c92dd3c8e 100644 --- a/g/os/gspath/gspath.go +++ b/g/os/gspath/gspath.go @@ -106,6 +106,7 @@ func (sp *SPath) Size() int { // 添加文件监控,当文件删除时,同时也删除搜索结果缓存 func (sp *SPath) addMonitor(name, path string) { + glog.Debug("gspath.addMonitor:", name, path) gfsnotify.Add(path, func(event *gfsnotify.Event) { glog.Debug("gspath.monitor:", event) if event.IsRemove() { diff --git a/geg/other/test.go b/geg/other/test.go index a452b09d8..ce6445183 100644 --- a/geg/other/test.go +++ b/geg/other/test.go @@ -3,8 +3,14 @@ package main import ( "gitee.com/johng/gf/g" "gitee.com/johng/gf/g/net/ghttp" + "fmt" + "gitee.com/johng/gf/g/os/gfile" ) +func init() { + fmt.Println(gfile.MainPkgPath()) +} + func main() { s := g.Server()