Example #1
0
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])
}
Example #2
0
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])
}