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()