示例#1
0
文件: log.go 项目: num5/spider
func init() {
	env.Load()
	var err error

	var chanlen int
	chanlen, err = strconv.Atoi(os.Getenv("LOG_CACHE_LEN"))
	if err != nil || chanlen == 0 {
		chanlen = 10000
	}

	l = log5.NewLog(uint64(chanlen))

	level := os.Getenv("LOG_LEVEL")
	if level != "" {
		l.SetLevel(level)
	}

	engine := os.Getenv("LOG_ENGINE")
	if engine == "file" {
		logfile := os.Getenv("LOG_FILE_NAME")
		logspilt := os.Getenv("LOG_FILE_SPILT")
		logsize := os.Getenv("LOG_FILE_SIZE")
		lfconf := fmt.Sprintf(`{"spilt":"%s","filename":"%s","maxsize":"%s"}`, logspilt, logfile, logsize)
		l = l.SetEngine(engine, lfconf)
	}

	funccall := os.Getenv("LOG_FUNC_CALL")
	if funccall == "true" {
		l.SetFuncCall(true).SetFuncCallDepth(3)
	}

}
示例#2
0
文件: log.go 项目: num5/deep-space
func init() {
	l = log5.NewLog(1000)
	//l.SetFuncCall(true)
	//l.SetFuncCallDepth(3)
}