示例#1
0
文件: log.go 项目: sillydong/goczd
func InitGoMultiLog(filedir string, level int, maxdays int) {
	if !path.IsAbs(filedir) {
		workingdir, _ := gofile.WorkDir()
		if workingdir != "" {
			filedir = path.Join(workingdir, filedir)
		}
	}
	os.MkdirAll(filedir, 0777)

	blog4go.NewFileWriter(filedir, true)
	//兼容旧库loglevel 7
	if level > 5 {
		level = 1
	}
	blog4go.SetLevel(blog4go.Levels[level])
}
示例#2
0
文件: log.go 项目: sillydong/goczd
func InitGoLog(filename string, level int, maxdays int) {
	if !path.IsAbs(filename) {
		workingdir, _ := gofile.WorkDir()
		if workingdir != "" {
			filename = path.Join(workingdir, filename)
		}
	}
	diroflog := path.Dir(filename)
	os.MkdirAll(diroflog, 0777)

	blog4go.NewBaseFileWriter(filename, true)
	//兼容旧库loglevel 7
	if level > 5 {
		level = 1
	}
	blog4go.SetLevel(blog4go.Levels[level])
}