示例#1
0
文件: beeweb.go 项目: JoeyFan/beeweb
func init() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	// Set App version and log level.
	if beego.AppConfig.String("runmode") == "pro" {
		beego.SetLevel(beego.LevelInfo)

		beego.Info("Beego Web", APP_VER)

		os.Mkdir("./log", os.ModePerm)
		filew := beego.NewFileWriter("log/log", true)
		err := filew.StartLogger()
		if err != nil {
			beego.Critical("NewFileWriter ->", err)
		}
	}
}
示例#2
0
func init() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	beego.SessionOn = true
	beego.SessionName = "BTCSport"
	beego.HttpPort = 8080

	os.Mkdir("./log", os.ModePerm)
	fw := beego.NewFileWriter("./log/log", true)
	fw.SetRotateMaxDays(30)
	fw.SetRotateSize(1 << 25)
	err := fw.StartLogger()
	if err != nil {
		beego.Critical("NewFileWriter ->", err)
	}

	beego.EnableXSRF = true
	beego.XSRFKEY = "WO@ilws1314"
	beego.XSRFExpire = 300
}
示例#3
0
func init() {
	// Try to have highest performance.
	runtime.GOMAXPROCS(runtime.NumCPU())

	// Set application log level.
	if beego.AppConfig.String("runmode") == "pro" {
		beego.SetLevel(beego.LevelInfo)
	}

	beego.Info("Go Walker", VERSION)

	// ----- Initialize log file -----
	os.Mkdir("./log", os.ModePerm)
	filew := beego.NewFileWriter("log/log.log", true)
	err := filew.StartLogger()
	if err != nil {
		beego.Critical("NewFileWriter ->", err)
	}

	doc.SetGithubCredentials(beego.AppConfig.String("client_id"), beego.AppConfig.String("client_secret"))
}
示例#4
0
func init() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	// Set App version and log level.
	routers.AppVer = "v" + APP_VER

	if beego.AppConfig.String("runmode") == "pro" {
		beego.SetLevel(beego.LevelInfo)

		beego.Info("Go Walker Server", APP_VER)

		os.Mkdir("../log", os.ModePerm)
		fw := beego.NewFileWriter("../log/log", true)
		err := fw.StartLogger()
		if err != nil {
			beego.Critical("NewFileWriter ->", err)
		}
	}

	doc.SetGithubCredentials(utils.Cfg.MustValue("github", "client_id"),
		utils.Cfg.MustValue("github", "client_secret"))
}