Example #1
0
func main() {
	logger.Get("main")
	hgoo.LogEnable = true
	hgoo.HttpPort = 8081
	hgoo.AppName = "Test Web App"
	hgoo.WebApp("webapp") //Relative to the current program directory
	hgoo.Static("static")
	hgoo.Template("public/template")
	hgoo.TemplateExt = "tpl" //default tpl
	hgoo.ObtainRoutes("/", &routers.HomeRouter{}).Get("Index").Post("PostIndex")
	hgoo.ObtainRoutes("/user/:uid", &routers.UserRouter{}).Get("Info")

	//	hgoo.ObtainHandlers("/timeline/:id", ).Get(func(http.ResponseWriter, *http.Request) {
	//	}).Put(func(http.ResponseWriter, *http.Request) {
	//	})

	//hgoo.Router("/", &routers.HomeRouter{}, "get,post:Index")
	//hgoo.Router("/user", &routers.UserRouter{}, "get,post:Info;post:Add;delete:Delete")

	logger.Get("main").Register(logger.FileLogger())
	logger.Get("main").Register(logger.ConsoleLogger())
	//	log.D("打印Debug信息 %d", 1)
	//	log.V("打印Verbose信息 %d", 2)
	//	log.W("打印Warning信息 %d", 3)
	hgoo.Run()
}
Example #2
0
func TestNewLogger(t *testing.T) {
	log := logger.Get("test logger")
	//default add ConsoleLogger
	//log.Register(logger.FileLogger())
	log.I("this debug info")
	//	log.I("this debug info")
}
Example #3
0
File: app.go Project: hgoo/hgoo
func init() {
	log = logger.Get("hgoo")
}