mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
gspath添加debug信息,改进glog链式操作方法
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user